Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into…
Browse files Browse the repository at this point in the history
… staging

* Kconfig improvements (msi_nonbroken, imply for default PCI devices)
* intel-iommu: sharing passthrough FlatViews (Peter)
* Fix for SEV with VFIO (Brijesh)
* Allow compilation without CONFIG_PARALLEL (Thomas)

# gpg: Signature made Thu 21 Mar 2019 16:42:24 GMT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream: (23 commits)
  virtio-vga: only enable for specific boards
  config-all-devices.mak: rebuild on reconfigure
  minikconf: fix parser typo
  intel-iommu: optimize nodmar memory regions
  test-announce-self: convert to qgraph
  hw/alpha/Kconfig: DP264 hardware requires e1000 network card
  hw/hppa/Kconfig: Dino board requires e1000 network card
  hw/sh4/Kconfig: r2d machine requires the rtl8139 network card
  hw/ppc/Kconfig: e500 based machines require virtio-net-pci device
  hw/ppc/Kconfig: Bamboo machine requires e1000 network card
  hw/mips/Kconfig: Fulong 2e board requires ati-vga/rtl8139 PCI devices
  hw/mips/Kconfig: Malta machine requires the pcnet network card
  hw/i386/Kconfig: enable devices that can be created by default
  hw/isa/Kconfig: PIIX4 southbridge requires USB UHCI
  hw/isa/Kconfig: i82378 SuperIO requires PC speaker device
  prep: do not select I82374
  hw/i386/Kconfig: PC uses I8257, not I82374
  hw/char/parallel: Make it possible to compile also without CONFIG_PARALLEL
  target/i386: sev: Do not pin the ram device memory region
  memory: Fix the memory region type assignment order
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

# Conflicts:
#	hw/rdma/Makefile.objs
#	hw/riscv/sifive_plic.c
  • Loading branch information
pm215 committed Mar 28, 2019
2 parents 2fc8d6f + 938912a commit 84bdc58
Show file tree
Hide file tree
Showing 34 changed files with 172 additions and 134 deletions.
3 changes: 3 additions & 0 deletions Kconfig.host
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ config XEN

config VIRTFS
bool

config PVRDMA
bool
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, $(TAR
SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))

ifeq ($(SUBDIR_DEVICES_MAK),)
config-all-devices.mak:
config-all-devices.mak: config-host.mak
$(call quiet-command,echo '# no devices' > $@,"GEN","$@")
else
config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
config-all-devices.mak: $(SUBDIR_DEVICES_MAK) config-host.mak
$(call quiet-command, sed -n \
's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
$(SUBDIR_DEVICES_MAK) | sort -u > $@, \
Expand All @@ -356,7 +356,8 @@ MINIKCONF_ARGS = \
CONFIG_X11=$(CONFIG_X11) \
CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \
CONFIG_VIRTFS=$(CONFIG_VIRTFS) \
CONFIG_LINUX=$(CONFIG_LINUX)
CONFIG_LINUX=$(CONFIG_LINUX) \
CONFIG_PVRDMA=$(CONFIG_PVRDMA)

MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host $(SRC_PATH)/hw/Kconfig
MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py \
Expand Down
1 change: 1 addition & 0 deletions default-configs/mips-softmmu-common.mak
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ CONFIG_MIPS_CPS=y
CONFIG_MIPS_ITU=y
CONFIG_R4K=y
CONFIG_MALTA=y
CONFIG_PCNET_PCI=y
CONFIG_MIPSSIM=y
CONFIG_ACPI_SMBUS=y
CONFIG_SMBUS_EEPROM=y
Expand Down
2 changes: 2 additions & 0 deletions default-configs/mips64el-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CONFIG_RC4030=y
CONFIG_DP8393X=y
CONFIG_DS1225Y=y
CONFIG_FULONG=y
CONFIG_ATI_VGA=y
CONFIG_RTL8139_PCI=y
CONFIG_JAZZ=y
CONFIG_G364FB=y
CONFIG_JAZZ_LED=y
Expand Down
1 change: 1 addition & 0 deletions hw/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ source pci-bridge/Kconfig
source pci-host/Kconfig
source pcmcia/Kconfig
source pci/Kconfig
source rdma/Kconfig
source scsi/Kconfig
source sd/Kconfig
source smbios/Kconfig
Expand Down
1 change: 1 addition & 0 deletions hw/alpha/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ config DP264
bool
imply PCI_DEVICES
imply TEST_DEVICES
imply E1000_PCI
select I82374
select I8254
select I8259
Expand Down
2 changes: 1 addition & 1 deletion hw/char/Makefile.objs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ common-obj-$(CONFIG_IPACK) += ipoctal232.o
common-obj-$(CONFIG_ESCC) += escc.o
common-obj-$(CONFIG_NRF51_SOC) += nrf51_uart.o
common-obj-$(CONFIG_PARALLEL) += parallel.o
common-obj-$(CONFIG_PARALLEL) += parallel-isa.o
common-obj-$(CONFIG_ISA_BUS) += parallel-isa.o
common-obj-$(CONFIG_PL011) += pl011.o
common-obj-$(CONFIG_SERIAL) += serial.o
common-obj-$(CONFIG_SERIAL_ISA) += serial-isa.o
Expand Down
3 changes: 3 additions & 0 deletions hw/char/parallel-isa.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
* QEMU Parallel PORT (ISA bus helpers)
*
* These functions reside in a separate file since they also might be
* required for linking when compiling QEMU without CONFIG_PARALLEL.
*
* Copyright (c) 2003 Fabrice Bellard
*
* SPDX-License-Identifier: MIT
Expand Down
2 changes: 1 addition & 1 deletion hw/display/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ config VIRTIO_GPU

config VIRTIO_VGA
bool
default y if PCI_DEVICES
# defaults to "N", enabled by specific boards
depends on VIRTIO_PCI
select VGA

Expand Down
2 changes: 2 additions & 0 deletions hw/hppa/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
config DINO
bool
imply PCI_DEVICES
imply E1000_PCI
imply VIRTIO_VGA
select PCI
select SERIAL
select ISA_BUS
Expand Down
8 changes: 5 additions & 3 deletions hw/i386/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ config PC
imply ISA_IPMI_KCS
imply ISA_IPMI_BT
imply ISA_DEBUG
imply PARALLEL
imply PCI_DEVICES
imply PVPANIC
imply QXL
Expand All @@ -17,16 +18,15 @@ config PC
imply TEST_DEVICES
imply TPM_CRB
imply TPM_TIS
imply VGA_PCI
imply VIRTIO_VGA
select FDC
select I8259
select I8254
select PCKBD
select PCSPK
select I82374
select I8257
select MC146818RTC
# Needed by the board code:
select PARALLEL
# For ACPI builder:
select SERIAL_ISA
select ACPI_VMGENID
Expand All @@ -49,6 +49,7 @@ config PC_ACPI

config I440FX
bool
imply E1000_PCI
select PC_PCI
select PC_ACPI
select ACPI_SMBUS
Expand All @@ -74,6 +75,7 @@ config Q35
bool
imply VTD
imply AMD_IOMMU
imply E1000E_PCI_EXPRESS
select PC_PCI
select PC_ACPI
select PCI_EXPRESS_Q35
Expand Down
91 changes: 58 additions & 33 deletions hw/i386/intel_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1485,11 +1485,11 @@ static bool vtd_switch_address_space(VTDAddressSpace *as)

/* Turn off first then on the other */
if (use_iommu) {
memory_region_set_enabled(&as->sys_alias, false);
memory_region_set_enabled(&as->nodmar, false);
memory_region_set_enabled(MEMORY_REGION(&as->iommu), true);
} else {
memory_region_set_enabled(MEMORY_REGION(&as->iommu), false);
memory_region_set_enabled(&as->sys_alias, true);
memory_region_set_enabled(&as->nodmar, true);
}

if (take_bql) {
Expand Down Expand Up @@ -3286,7 +3286,8 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn)
vtd_dev_as = vtd_bus->dev_as[devfn];

if (!vtd_dev_as) {
snprintf(name, sizeof(name), "intel_iommu_devfn_%d", devfn);
snprintf(name, sizeof(name), "vtd-%02x.%x", PCI_SLOT(devfn),
PCI_FUNC(devfn));
vtd_bus->dev_as[devfn] = vtd_dev_as = g_malloc0(sizeof(VTDAddressSpace));

vtd_dev_as->bus = bus;
Expand All @@ -3295,44 +3296,53 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn)
vtd_dev_as->context_cache_entry.context_cache_gen = 0;
vtd_dev_as->iova_tree = iova_tree_new();

memory_region_init(&vtd_dev_as->root, OBJECT(s), name, UINT64_MAX);
address_space_init(&vtd_dev_as->as, &vtd_dev_as->root, "vtd-root");

/*
* Memory region relationships looks like (Address range shows
* only lower 32 bits to make it short in length...):
*
* |-----------------+-------------------+----------|
* | Name | Address range | Priority |
* |-----------------+-------------------+----------+
* | vtd_root | 00000000-ffffffff | 0 |
* | intel_iommu | 00000000-ffffffff | 1 |
* | vtd_sys_alias | 00000000-ffffffff | 1 |
* | intel_iommu_ir | fee00000-feefffff | 64 |
* |-----------------+-------------------+----------|
* Build the DMAR-disabled container with aliases to the
* shared MRs. Note that aliasing to a shared memory region
* could help the memory API to detect same FlatViews so we
* can have devices to share the same FlatView when DMAR is
* disabled (either by not providing "intel_iommu=on" or with
* "iommu=pt"). It will greatly reduce the total number of
* FlatViews of the system hence VM runs faster.
*/
memory_region_init_alias(&vtd_dev_as->nodmar, OBJECT(s),
"vtd-nodmar", &s->mr_nodmar, 0,
memory_region_size(&s->mr_nodmar));

/*
* Build the per-device DMAR-enabled container.
*
* We enable/disable DMAR by switching enablement for
* vtd_sys_alias and intel_iommu regions. IR region is always
* enabled.
* TODO: currently we have per-device IOMMU memory region only
* because we have per-device IOMMU notifiers for devices. If
* one day we can abstract the IOMMU notifiers out of the
* memory regions then we can also share the same memory
* region here just like what we've done above with the nodmar
* region.
*/
strcat(name, "-dmar");
memory_region_init_iommu(&vtd_dev_as->iommu, sizeof(vtd_dev_as->iommu),
TYPE_INTEL_IOMMU_MEMORY_REGION, OBJECT(s),
"intel_iommu_dmar",
UINT64_MAX);
memory_region_init_alias(&vtd_dev_as->sys_alias, OBJECT(s),
"vtd_sys_alias", get_system_memory(),
0, memory_region_size(get_system_memory()));
memory_region_init_io(&vtd_dev_as->iommu_ir, OBJECT(s),
&vtd_mem_ir_ops, s, "intel_iommu_ir",
VTD_INTERRUPT_ADDR_SIZE);
memory_region_init(&vtd_dev_as->root, OBJECT(s),
"vtd_root", UINT64_MAX);
memory_region_add_subregion_overlap(&vtd_dev_as->root,
name, UINT64_MAX);
memory_region_init_alias(&vtd_dev_as->iommu_ir, OBJECT(s), "vtd-ir",
&s->mr_ir, 0, memory_region_size(&s->mr_ir));
memory_region_add_subregion_overlap(MEMORY_REGION(&vtd_dev_as->iommu),
VTD_INTERRUPT_ADDR_FIRST,
&vtd_dev_as->iommu_ir, 64);
address_space_init(&vtd_dev_as->as, &vtd_dev_as->root, name);
memory_region_add_subregion_overlap(&vtd_dev_as->root, 0,
&vtd_dev_as->sys_alias, 1);
&vtd_dev_as->iommu_ir, 1);

/*
* Hook both the containers under the root container, we
* switch between DMAR & noDMAR by enable/disable
* corresponding sub-containers
*/
memory_region_add_subregion_overlap(&vtd_dev_as->root, 0,
MEMORY_REGION(&vtd_dev_as->iommu),
1);
0);
memory_region_add_subregion_overlap(&vtd_dev_as->root, 0,
&vtd_dev_as->nodmar, 0);

vtd_switch_address_space(vtd_dev_as);
}
return vtd_dev_as;
Expand Down Expand Up @@ -3676,6 +3686,21 @@ static void vtd_realize(DeviceState *dev, Error **errp)
memset(s->vtd_as_by_bus_num, 0, sizeof(s->vtd_as_by_bus_num));
memory_region_init_io(&s->csrmem, OBJECT(s), &vtd_mem_ops, s,
"intel_iommu", DMAR_REG_SIZE);

/* Create the shared memory regions by all devices */
memory_region_init(&s->mr_nodmar, OBJECT(s), "vtd-nodmar",
UINT64_MAX);
memory_region_init_io(&s->mr_ir, OBJECT(s), &vtd_mem_ir_ops,
s, "vtd-ir", VTD_INTERRUPT_ADDR_SIZE);
memory_region_init_alias(&s->mr_sys_alias, OBJECT(s),
"vtd-sys-alias", get_system_memory(), 0,
memory_region_size(get_system_memory()));
memory_region_add_subregion_overlap(&s->mr_nodmar, 0,
&s->mr_sys_alias, 0);
memory_region_add_subregion_overlap(&s->mr_nodmar,
VTD_INTERRUPT_ADDR_FIRST,
&s->mr_ir, 1);

sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->csrmem);
/* No corresponding destroy */
s->iotlb = g_hash_table_new_full(vtd_uint64_hash, vtd_uint64_equal,
Expand Down
3 changes: 3 additions & 0 deletions hw/intc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ config IOAPIC

config ARM_GIC
bool
select MSI_NONBROKEN

config OPENPIC
bool
select MSI_NONBROKEN

config APIC
bool
select MSI_NONBROKEN

config ARM_GIC_KVM
bool
Expand Down
2 changes: 2 additions & 0 deletions hw/isa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ config I82378
select I8254
select I82374
select MC146818RTC
select PCSPK

config PC87312
bool
Expand All @@ -29,6 +30,7 @@ config PIIX4
# For historical reasons, SuperIO devices are created in the board
# for PIIX4.
select ISA_BUS
select USB_UHCI

config VT82C686
bool
Expand Down
4 changes: 2 additions & 2 deletions hw/misc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ config PCI_TESTDEV
config EDU
bool
default y if TEST_DEVICES
depends on PCI
depends on PCI && MSI_NONBROKEN

config PCA9552
bool
Expand Down Expand Up @@ -67,7 +67,7 @@ config MACIO
config IVSHMEM_DEVICE
bool
default y if PCI_DEVICES
depends on PCI && LINUX && IVSHMEM
depends on PCI && LINUX && IVSHMEM && MSI_NONBROKEN

config ECCMEMCTL
bool
Expand Down
4 changes: 2 additions & 2 deletions hw/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ config E1000_PCI
config E1000E_PCI_EXPRESS
bool
default y if PCI_DEVICES
depends on PCI_EXPRESS
depends on PCI_EXPRESS && MSI_NONBROKEN

config RTL8139_PCI
bool
Expand Down Expand Up @@ -107,7 +107,7 @@ config ETSEC
config ROCKER
bool
default y if PCI_DEVICES
depends on PCI
depends on PCI && MSI_NONBROKEN

config CAN_BUS
bool
Expand Down
6 changes: 3 additions & 3 deletions hw/pci-bridge/Kconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config PCIE_PORT
bool
default y if PCI_DEVICES
depends on PCI_EXPRESS
depends on PCI_EXPRESS && MSI_NONBROKEN

config PXB
bool
Expand All @@ -10,12 +10,12 @@ config PXB
config XIO3130
bool
default y if PCI_DEVICES
depends on PCI_EXPRESS
depends on PCI_EXPRESS && MSI_NONBROKEN

config IOH3420
bool
default y if PCI_DEVICES
depends on PCI_EXPRESS
depends on PCI_EXPRESS && MSI_NONBROKEN

config I82801B11
bool
Expand Down
1 change: 1 addition & 0 deletions hw/pci-host/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ config PCI_EXPRESS_XILINX
config PCI_EXPRESS_DESIGNWARE
bool
select PCI_EXPRESS
select MSI_NONBROKEN
6 changes: 6 additions & 0 deletions hw/pci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ config PCI_EXPRESS

config PCI_DEVICES
bool

config MSI_NONBROKEN
# selected by interrupt controllers that do not support MSI,
# or support it and have a good implementation. See commit
# 47d2b0f33c664533b8dbd5cb17faa8e6a01afe1f.
bool
Loading

0 comments on commit 84bdc58

Please sign in to comment.