[PULL 22/42] virtio-iommu: Compute host reserved regions

2024-06-24 Thread Cédric Le Goater
From: Eric Auger Compute the host reserved regions in virtio_iommu_set_iommu_device(). The usable IOVA regions are retrieved from the HostIOMMUDevice. The virtio_iommu_set_host_iova_ranges() helper turns usable regions into complementary reserved regions while testing the inclusion into existing

[PULL 14/42] vfio/pci: Pass HostIOMMUDevice to vIOMMU

2024-06-24 Thread Cédric Le Goater
From: Zhenzhong Duan With HostIOMMUDevice passed, vIOMMU can check compatibility with host IOMMU, call into IOMMUFD specific methods, etc. Originally-by: Yi Liu Signed-off-by: Nicolin Chen Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Reviewed-by: Michael S. Ts

[PULL 32/42] vfio/container: Modify vfio_get_iommu_type() to use a container fd

2024-06-24 Thread Cédric Le Goater
The 'container' pointer has no other use than its 'fd' attribute. Simplify the prototype to ease future changes. Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio/container.c | 6 +++--- 1 file changed

[PULL 38/42] vfio/container: Introduce an instance_init() handler

2024-06-24 Thread Cédric Le Goater
This allows us to move the initialization code from vfio_container_init(), which we will soon remove. Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio/container-base.c | 19 +-- 1 file changed, 13 insertions

[PULL 26/42] vfio: Make vfio_devices_dma_logging_start() return bool

2024-06-24 Thread Cédric Le Goater
lue can be saved in the migration stream when called from vfio_listener_log_global_stop(). Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio/common.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff

[PULL 18/42] HostIOMMUDevice: Store the VFIO/VDPA agent

2024-06-24 Thread Cédric Le Goater
From: Eric Auger Store the agent device (VFIO or VDPA) in the host IOMMU device. This will allow easy access to some of its resources. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Michael S. Tsirkin --- include/sysemu/host_iommu_device.h | 1 + hw/vfio/container.c

[PULL 37/42] vfio/container: Switch to QOM

2024-06-24 Thread Cédric Le Goater
Instead of allocating the container struct, create a QOM object of the appropriate type. Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio/container.c | 6 +++--- hw/vfio/iommufd.c | 4 ++-- 2 files changed, 5 insertions

[PULL 40/42] vfio/container: Remove vfio_container_init()

2024-06-24 Thread Cédric Le Goater
It's now empty. Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-container-base.h | 2 -- hw/vfio/container-base.c | 5 - hw/vfio/container.c | 3 --- hw/vfio/iomm

[PULL 31/42] vfio/container: Simplify vfio_container_init()

2024-06-24 Thread Cédric Le Goater
ill assign the 'space' pointer later in the execution flow. This should not have any consequence. Reviewed-by: Zhenzhong Duan Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-container-base.h | 1 - hw/vfio/common.c | 1 + hw/v

[PULL 41/42] vfio/container: Introduce vfio_iommu_legacy_instance_init()

2024-06-24 Thread Cédric Le Goater
Just as we did for the VFIOContainerBase object, introduce an instance_init() handler for the legacy VFIOContainer object and do the specific initialization there. Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio

[PULL 29/42] vfio/common: Extract vIOMMU code from vfio_sync_dirty_bitmap()

2024-06-24 Thread Cédric Le Goater
: - Rebased on upstream - Fixed typo in commit log ] Reviewed-by: Zhenzhong Duan Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio/common.c | 63 +--- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/hw/vfio/common.c b/hw

[PULL 15/42] intel_iommu: Extract out vtd_cap_init() to initialize cap/ecap

2024-06-24 Thread Cédric Le Goater
From: Zhenzhong Duan Extract cap/ecap initialization in vtd_cap_init() to make code cleaner. No functional change intended. Reviewed-by: Eric Auger Signed-off-by: Zhenzhong Duan Reviewed-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 93 --- 1 fil

[PULL 25/42] memory: Remove IOMMU MR iommu_set_iova_range API

2024-06-24 Thread Cédric Le Goater
From: Eric Auger Since the host IOVA ranges are now passed through the PCIIOMMUOps set_host_resv_regions and we have removed the only implementation of iommu_set_iova_range() in the virtio-iommu and the only call site in vfio/common, let's retire the IOMMU MR API and its memory wrapper. Signed-o

[PULL 07/42] backends/iommufd: Introduce helper function iommufd_backend_get_device_info()

2024-06-24 Thread Cédric Le Goater
From: Zhenzhong Duan Introduce a helper function iommufd_backend_get_device_info() to get host IOMMU related information through iommufd uAPI. Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Reviewed-by: Michael S. Tsirkin --- include/sysem

[PULL 13/42] hw/pci: Introduce pci_device_[set|unset]_iommu_device()

2024-06-24 Thread Cédric Le Goater
From: Yi Liu pci_device_[set|unset]_iommu_device() call pci_device_get_iommu_bus_devfn() to get iommu_bus->iommu_ops and call [set|unset]_iommu_device callback to set/unset HostIOMMUDevice for a given PCI device. Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Nicolin Chen Signed-o

[PULL 08/42] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler

2024-06-24 Thread Cédric Le Goater
From: Zhenzhong Duan It calls iommufd_backend_get_device_info() to get host IOMMU related information and translate it into HostIOMMUDeviceCaps for query with .get_cap(). For aw_bits, use the same way as legacy backend by calling vfio_device_get_aw_bits() which is common for different vendor IOM

[PULL 42/42] vfio/container: Move vfio_container_destroy() to an instance_finalize() handler

2024-06-24 Thread Cédric Le Goater
: Eric Auger Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-container-base.h | 3 --- hw/vfio/container-base.c | 4 +++- hw/vfio/container.c | 2 -- hw/vfio/iommufd.c | 1 - 4 files changed, 3 insertions(+), 7

[PULL 36/42] vfio/container: Change VFIOContainerBase to use QOM

2024-06-24 Thread Cédric Le Goater
adjustments in the VFIO_IOMMU hierarchy. Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 4 include/hw/vfio/vfio-container-base.h | 12 +++- hw/vfio/container-base.c

[PULL 24/42] hw/vfio: Remove memory_region_iommu_set_iova_ranges() call

2024-06-24 Thread Cédric Le Goater
From: Eric Auger As we have just removed the only implementation of iommu_set_iova_ranges IOMMU MR callback in the virtio-iommu, let's remove the call to the memory wrapper. Usable IOVA ranges are now conveyed through the PCIIOMMUOps in VFIO-PCI. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong

[PULL 35/42] vfio/container: Discover IOMMU type before creating the container

2024-06-24 Thread Cédric Le Goater
() to extract the part doing the container initialization and move it under vfio_create_container(). Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio/container.c | 47 ++--- 1 file

[PULL 17/42] intel_iommu: Check compatibility with host IOMMU capabilities

2024-06-24 Thread Cédric Le Goater
From: Zhenzhong Duan If check fails, host device (either VFIO or VDPA device) is not compatible with current vIOMMU config and should not be passed to guest. Only aw_bits is checked for now, we don't care about other caps before scalable modern mode is introduced. Signed-off-by: Yi Liu Signed-

[PULL 06/42] vfio/container: Implement HostIOMMUDeviceClass::realize() handler

2024-06-24 Thread Cédric Le Goater
From: Zhenzhong Duan The realize function populates the capabilities. For now only the aw_bits caps is computed for legacy backend. Introduce a helper function vfio_device_get_aw_bits() which calls range_get_last_bit() to get host aw_bits and package it in HostIOMMUDeviceCaps for query with .get

[PULL 39/42] vfio/container: Remove VFIOContainerBase::ops

2024-06-24 Thread Cédric Le Goater
Instead, use VFIO_IOMMU_GET_CLASS() to get the class pointer. Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-container-base.h | 1 - hw/vfio/common.c | 2 +- hw/vfio/container-base.c

[PULL 16/42] intel_iommu: Implement [set|unset]_iommu_device() callbacks

2024-06-24 Thread Cédric Le Goater
From: Yi Liu Implement [set|unset]_iommu_device() callbacks in Intel vIOMMU. In set call, we take a reference of HostIOMMUDevice and store it in hash table indexed by PCI BDF. Note this BDF index is device's real BDF not the aliased one which is different from the index of VTDAddressSpace. There

[PULL 00/42] vfio queue

2024-06-24 Thread Cédric Le Goater
bstraction * VIRTIO-IOMMU/VFIO: Fix host iommu geometry handling * QOMify VFIOContainer Avihai Horon (1): vfio/common: Extract vIOMMU code from vfio_sync_dirty_bitmap() Cédric Le Goater (15): vfio: Make vfio_devices_dma_log

[PULL 19/42] virtio-iommu: Implement set|unset]_iommu_device() callbacks

2024-06-24 Thread Cédric Le Goater
From: Eric Auger Implement PCIIOMMUOPs [set|unset]_iommu_device() callbacks. In set(), the HostIOMMUDevice handle is stored in a hash table indexed by PCI BDF. The object will allow to retrieve information related to the physical IOMMU. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Rev

[PULL 02/42] backends/host_iommu_device: Introduce HostIOMMUDeviceCaps

2024-06-24 Thread Cédric Le Goater
host IOMMU address width. Introduce .get_cap() handler to check if HOST_IOMMU_DEVICE_CAP_XXX is supported. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Reviewed-by: Michael S. Tsirkin --- include/sysemu/host_iommu_device.h | 38

[PULL 03/42] vfio/container: Introduce TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO device

2024-06-24 Thread Cédric Le Goater
From: Zhenzhong Duan TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO represents a host IOMMU device under VFIO legacy container backend. It will have its own realize implementation. Suggested-by: Eric Auger Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Reviewed-by

[PULL 11/42] vfio: Create host IOMMU device instance

2024-06-24 Thread Cédric Le Goater
(). Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Reviewed-by: Michael S. Tsirkin --- include/hw/vfio/vfio-common.h | 1 + include/hw/vfio/vfio-container-base.h | 3 +++ hw/vfio/common.c | 16 +++- hw/vfio/container.c

[PULL 09/42] vfio/container: Implement HostIOMMUDeviceClass::get_cap() handler

2024-06-24 Thread Cédric Le Goater
From: Zhenzhong Duan Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Reviewed-by: Michael S. Tsirkin --- hw/vfio/container.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/hw/vfio/container.c b/hw/vfio/container.c index

[PULL 05/42] range: Introduce range_get_last_bit()

2024-06-24 Thread Cédric Le Goater
From: Zhenzhong Duan This helper get the highest 1 bit position of the upper bound. If the range is empty or upper bound is zero, -1 is returned. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Reviewed-by: Michael S. Tsirkin --- include/qemu/range.h

Re: [PATCH v4 0/8] VIRTIO-IOMMU/VFIO: Fix host iommu geometry handling for hotplugged devices

2024-06-24 Thread Cédric Le Goater
On 6/14/24 11:52 AM, Eric Auger wrote: This series is based on Zhenzhong HostIOMMUDevice: [PATCH v7 00/17] Add a host IOMMU device abstraction to check with vIOMMU https://lore.kernel.org/all/20240605083043.317831-1-zhenzhong.d...@intel.com/ It allows to convey host IOVA reserved regions to the

Re: [PATCH v2 00/17] vfio: QOMify VFIOContainer

2024-06-24 Thread Cédric Le Goater
On 6/17/24 8:33 AM, Cédric Le Goater wrote: Hello, The series starts with simple changes (patch 1-4). Two of which were initially sent by Joao in a series adding VFIO migration support with vIOMMU [1]. The changes following prepare VFIOContainer for QOMification, switch the container models to

Re: [PATCH v7 00/17] Add a host IOMMU device abstraction to check with vIOMMU

2024-06-24 Thread Cédric Le Goater
On 6/5/24 10:30 AM, Zhenzhong Duan wrote: Hi, This series introduce a HostIOMMUDevice abstraction and sub-classes. Also HostIOMMUDeviceCaps structure in HostIOMMUDevice and a new interface between vIOMMU and HostIOMMUDevice. A HostIOMMUDevice is an abstraction for an assigned device that is pro

Re: [PATCH v7 00/17] Add a host IOMMU device abstraction to check with vIOMMU

2024-06-24 Thread Cédric Le Goater
On 6/24/24 12:26 PM, Michael S. Tsirkin wrote: On Wed, Jun 05, 2024 at 04:30:26PM +0800, Zhenzhong Duan wrote: Hi, This series introduce a HostIOMMUDevice abstraction and sub-classes. Also HostIOMMUDeviceCaps structure in HostIOMMUDevice and a new interface between vIOMMU and HostIOMMUDevice.

Re: [PATCH v1 1/2] aspeed/soc: fix coverity issue

2024-06-24 Thread Cédric Le Goater
On 6/24/24 4:01 PM, Peter Maydell wrote: On Mon, 24 Jun 2024 at 14:58, Cédric Le Goater wrote: On 6/24/24 2:18 PM, Peter Maydell wrote: On Wed, 19 Jun 2024 at 10:35, Jamin Lin wrote: Fix coverity defect: DIVIDE_BY_ZERO. Signed-off-by: Jamin Lin --- hw/arm/aspeed_ast27x0.c | 6

Re: [PATCH v1 1/2] aspeed/soc: fix coverity issue

2024-06-24 Thread Cédric Le Goater
On 6/24/24 2:18 PM, Peter Maydell wrote: On Wed, 19 Jun 2024 at 10:35, Jamin Lin wrote: Fix coverity defect: DIVIDE_BY_ZERO. Signed-off-by: Jamin Lin --- hw/arm/aspeed_ast27x0.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c ind

Re: [PATCH v1 2/2] aspeed/sdmc: fix coverity issue

2024-06-24 Thread Cédric Le Goater
_STATUS is handled before in the "Unprotected registers" switch statement. Remove it. Fixes: Coverity CID 1547112 with that, Reviewed-by: Cédric Le Goater Thanks, C. Signed-off-by: Jamin Lin --- hw/misc/aspeed_sdmc.c | 1 - 1 file changed, 1 deletion(-)

Re: [PATCH v1 1/2] aspeed/soc: fix coverity issue

2024-06-24 Thread Cédric Le Goater
erty. This can not happen because RAM has predefined valid sizes per SoC. Nevertheless, add a test to close the issue. Fixes: Coverity CID 1547113 with that, Reviewed-by: Cédric Le Goater Thanks, C. --- hw/arm/aspeed_ast27x0.c | 6 ++ 1 file changed, 6 insertions(+) diff

Re: [PATCH 00/23] hw/sd/sdcard: Accumulation of cleanups and fixes

2024-06-24 Thread Cédric Le Goater
| 2 +- hw/sd/trace-events | 7 +- 3 files changed, 159 insertions(+), 128 deletions(-) Tested-by: Cédric Le Goater Thanks, C.

Re: [PATCH 20/23] hw/sd/sdcard: Add comments around registers and commands

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 20 1 file changed, 20 insertions(+) diff

Re: [PATCH 18/23] hw/sd/sdcard: Add sd_invalid_mode_for_cmd to report invalid mode switch

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: Having the mode switch displayed help to track incomplete command implementations. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 75

Re: [PATCH 19/23] hw/sd/sdcard: Inline BLK_READ_BLOCK / BLK_WRITE_BLOCK macros

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: These macros only save 3 chars and make the code harder to maintain, simply remove them. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 15 +++ 1 file changed, 7

Re: [PATCH 17/23] hw/sd/sdcard: Only call sd_req_get_address() where address is used

2024-06-21 Thread Cédric Le Goater
eviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index a0193a46ea..1df16ce6a2 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -,7 +,7 @@ static sd_rsp_type_t sd_cmd_SET_BLOCK_COU

Re: [PATCH 16/23] hw/sd/sdcard: Factor sd_req_get_address() method out

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: Extract sd_cmd_get_address() so we can re-use it in various SDProto handlers. Use CARD_CAPACITY and HWBLOCK_SHIFT definitions instead of magic values. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C

Re: [PATCH 15/23] hw/sd/sdcard: Only call sd_req_get_rca() where RCA is used

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: It will be useful later to assert only AC commands (Addressed point-to-point Commands, defined as the 'sd_ac' enum) extract the RCA value from the command argument. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric

Re: [PATCH 14/23] hw/sd/sdcard: Factor sd_req_get_rca() method out

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: Extract sd_req_get_rca() so we can re-use it in various SDProto handlers. Return a 16-bit value since RCA is 16-bit. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 15

Re: [PATCH 13/23] hw/sd/sdcard: Have cmd_valid_while_locked() return a boolean value

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index c6cc1bab11..510784fc82 100644 --- a

Re: [PATCH 12/23] hw/sd/sdcard: Trace block offset in READ/WRITE data accesses

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: Useful to detect out of bound accesses. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 4 ++-- hw/sd/trace-events | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions

Re: [PATCH 11/23] hw/sd/sdcard: Trace update of block count (CMD23)

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 1 + hw/sd/trace-events | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index

Re: [PATCH 08/23] hw/sd/sdcard: Remove explicit entries for illegal commands

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: NULL handler is already handled as illegal, no need to duplicate (that keeps this array simpler to maintain). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 11 --- 1 file

Re: [PATCH 07/23] hw/sd/sdcard: Remove ACMD6 handler for SPI mode

2024-06-21 Thread Cédric Le Goater
e Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index b0cd30c657..e9af834a8c 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1012,6 +1012,7 @@ static sd_rsp_type_t sd_cmd_ille

Re: [PATCH 06/23] hw/sd/sdcard: Use Load/Store API to fill some CID/CSD registers

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: The ld/st API helps noticing CID or CSD bytes refer to the same field. Multi-bytes fields are stored MSB first in CID / CSD. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 9

Re: [PATCH 05/23] hw/sd/sdcard: Use registerfield CSR::CURRENT_STATE definition

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: Use registerfield-generated definitions to update card_status. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw

Re: [PATCH 03/23] hw/sd/sdcard: Fix typo in SEND_OP_COND command name

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: There is no SEND_OP_CMD but SEND_OP_COND. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 6 +++--- hw/sd/sdmmc-internal.c | 2 +- 2 files changed, 4 insertions(+), 4

Re: [PATCH 04/23] hw/sd/sdcard: Use HWBLOCK_SHIFT definition instead of magic values

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

Re: [PATCH 02/23] hw/sd/sdcard: Rewrite sd_cmd_ALL_SEND_CID using switch case (CMD2)

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote: Keep this handler style in sync with other handlers by using a switch() case, which might become handy to handle other states. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C. --- hw/sd/sd.c | 10

Re: [PATCH 01/23] hw/sd/sdcard: Correct code indentation

2024-06-21 Thread Cédric Le Goater
1 file changed, 17 insertions(+), 17 deletions(-) Reviewed-by: Cédric Le Goater Thanks, C. diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 16d8d52a78..626e99ecd6 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1069,33 +1069,33 @@ static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR(SDState *sd, SDRequ

Re: [PATCH] vfio: container: Fix missing allocation of VFIOSpaprContainer

2024-06-21 Thread Cédric Le Goater
On 6/21/24 4:47 PM, Shivaprasad G Bhat wrote: On 6/21/24 2:19 PM, Cédric Le Goater wrote: Could you please describe the host/guest OS, hypervisor, processor and adapter ? Here is the environment info, pSeries: Host : Power10 PowerVM  Lpar Kernel: Upstream 6.10.0-rc4 + VFIO fixes posted

Re: [PATCH v1 2/2] hw/net:ftgmac100: support 64 bits dma dram address for AST2700

2024-06-21 Thread Cédric Le Goater
On 6/19/24 12:01 PM, Jamin Lin wrote: ASPEED AST2700 SOC is a 64 bits quad core CPUs (Cortex-a35) And the base address of dram is "0x4 " which is 64bits address. It have "Normal Priority Transmit Ring Base Address Register High(0x17C)", "High Priority Transmit Ring Base Address Register

Re: [PATCH] vfio: container: Fix missing allocation of VFIOSpaprContainer

2024-06-21 Thread Cédric Le Goater
On 6/21/24 10:17 AM, Shivaprasad G Bhat wrote: Hi Cédric, On 6/20/24 6:37 PM, Cédric Le Goater wrote: Shivaprasad, On 5/9/24 9:14 PM, Shivaprasad G Bhat wrote: The commit 6ad359ec29 "(vfio/spapr: Move prereg_listener into spapr container)" began to use the newly introduced VFIOSpap

Re: [PATCH] bswap: Add st24_be_p() to store 24 bits in big-endian order

2024-06-21 Thread Cédric Le Goater
re 3 bytes wide stored MSB first. --- Reviewed-by: Cédric Le Goater Thanks, C. include/qemu/bswap.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index bd67468e5e..ad22910a5d 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h

Re: [PATCH v4] hw/gpio/aspeed: Add reg_table_count to AspeedGPIOClass

2024-06-20 Thread Cédric Le Goater
On 6/20/24 4:02 PM, Zheyu Ma wrote: ASan detected a global-buffer-overflow error in the aspeed_gpio_read() function. This issue occurred when reading beyond the bounds of the reg_table. To enhance the safety and maintainability of the Aspeed GPIO code, this commit introduces a reg_table_count me

Re: [PATCH] vfio: container: Fix missing allocation of VFIOSpaprContainer

2024-06-20 Thread Cédric Le Goater
Shivaprasad, On 5/9/24 9:14 PM, Shivaprasad G Bhat wrote: The commit 6ad359ec29 "(vfio/spapr: Move prereg_listener into spapr container)" began to use the newly introduced VFIOSpaprContainer structure. After several refactors, today the container_of(container, VFIOSpaprContainer, ABC) is used w

Re: [PATCH v3] hw/gpio/aspeed: Add reg_table_size to AspeedGPIOClass

2024-06-20 Thread Cédric Le Goater
@@ -75,6 +75,7 @@ struct AspeedGPIOClass {   uint32_t nr_gpio_pins;   uint32_t nr_gpio_sets;   const AspeedGPIOReg *reg_table; +    uint32_t reg_table_size;   }; - "reg_table_size" is a number of registers, using s/size/count/ might   be clearer. - No point in specifying 32-bit,

Re: [PATCH v4 00/15] vfio: VFIO migration support with vIOMMU

2024-06-20 Thread Cédric Le Goater
[ ... ] * [v4] vfio: VFIO migration support with vIOMMU https://lore.kernel.org/qemu-devel/20230622214845.3980-1-joao.m.mart...@oracle.com/     Refreshed the patchset on upstream and pushed on vfio-9.1 branch. /me nods Probably deserves an item on the list too related to this subject of v

Re: [PATCH 22/32] hw/sd: Add emmc_cmd_SEND_EXT_CSD() handler

2024-06-20 Thread Cédric Le Goater
Hello On 6/19/24 7:40 PM, Philippe Mathieu-Daudé wrote: Hi, On 3/7/23 15:24, Cédric Le Goater wrote: The parameters mimick a real 4GB eMMC, but it can be set to various sizes. Initially from Vincent Palatin Signed-off-by: Cédric Le Goater ---   hw/sd/sdmmc-internal.h |  97

Re: [PATCH v1 1/2] hw/net:ftgmac100: fix coding style

2024-06-20 Thread Cédric Le Goater
On 6/19/24 12:01 PM, Jamin Lin wrote: Fix coding style issues from checkpatch.pl Test command: ./scripts/checkpatch.pl --no-tree -f hw/net/ftgmac100.c Signed-off-by: Jamin Lin Reviewed-by: Cédric Le Goater Thanks, C. --- hw/net/ftgmac100.c | 12 1 file changed, 8

Re: [PATCH v3] hw/gpio/aspeed: Add reg_table_size to AspeedGPIOClass

2024-06-19 Thread Cédric Le Goater
On 6/19/24 8:36 PM, Zheyu Ma wrote: ASan detected a global-buffer-overflow error in the aspeed_gpio_read() function. This issue occurred when reading beyond the bounds of the reg_table. To enhance the safety and maintainability of the Aspeed GPIO code, this commit introduces a reg_table_size mem

Re: [PATCH 5/5] pnv/xive2: Move xive2_nvp_pic_print_info() to xive2.c

2024-06-18 Thread Cédric Le Goater
l Kowal Looks correct. You might need to rebase because Philippe sent changes on the same routines. Reviewed-by: Cédric Le Goater Thanks, C. --- include/hw/ppc/xive2_regs.h | 9 + hw/intc/pnv_xive2.c | 27 --- hw/intc/xive.c |

Re: [PATCH 4/5] pnv/xive2: Fail VST entry address computation if table has no VSD

2024-06-18 Thread Cédric Le Goater
operation and log an error. Signed-off-by: Michael Kowal Reviewed-by: Cédric Le Goater Thanks, C. --- hw/intc/pnv_xive2.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c index a1146311a3..e473109196 100644 --- a/hw/intc/pnv_xive2.c +++

Re: [PATCH 3/5] pnv/xive2: Set Translation Table for the NVC port space

2024-06-18 Thread Cédric Le Goater
(NVC), like it's already done for the other VST tables. Signed-off-by: Michael Kowal Reviewed-by: Cédric Le Goater Thanks, C. --- hw/intc/pnv_xive2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c index ff3d2d9c7b..a1146311a3 10064

Re: [PATCH 2/5] pnv/xive2: Enable VST NVG and NVC index compression

2024-06-18 Thread Cédric Le Goater
shift 0010 - 2 bit shift 1000 - 8 bit shift 1001- - No compression Signed-off-by: Michael Kowal Reviewed-by: Cédric Le Goater Thanks, C. --- hw/intc/pnv_xive2_regs.h | 2 ++ hw/intc/pnv_xive2.c | 20 2 files changed, 22 insertions

Re: [PATCH 1/5] pnv/xive2: XIVE2 Cache Watch, Cache Flush and Sync Injection support

2024-06-18 Thread Cédric Le Goater
Hello Michael, On 6/17/24 10:42 PM, Michael Kowal wrote: From: Frederic Barrat XIVE offers a 'cache watch facility', which allows software to read/update a potentially cached table entry with no software lock. There's one such facility in the Virtualization Controller (VC) to update the ESB an

Re: [PATCH v4 5/5] tests/qtest: Add pnv-spi-seeprom qtest

2024-06-18 Thread Cédric Le Goater
On 6/17/24 6:54 PM, Chalapathi V wrote: In this commit Write a qtest pnv-spi-seeprom-test to check the SPI transactions between spi controller and seeprom device. Signed-off-by: Chalapathi V Acked-by: Cédric Le Goater Thanks, C. --- tests/qtest/pnv-spi-seeprom-test.c | 110

Re: [PATCH v4 2/5] ppc/pnv: Extend SPI model

2024-06-18 Thread Cédric Le Goater
On 6/17/24 6:54 PM, Chalapathi V wrote: In this commit SPI shift engine and sequencer logic is implemented. Shift engine performs serialization and de-serialization according to the control by the sequencer and according to the setup defined in the configuration registers. Sequencer implements th

Re: [PATCH v4 1/5] ppc/pnv: Add SPI model

2024-06-18 Thread Cédric Le Goater
Hello Chalapathi, On 6/17/24 6:54 PM, Chalapathi V wrote: SPI controller device model supports a connection to a single SPI responder. This provide access to SPI seeproms, TPM, flash device and an ADC controller. All SPI function control is mapped into the SPI register space to enable full cont

Re: [PATCH v2 00/17] vfio: QOMify VFIOContainer

2024-06-18 Thread Cédric Le Goater
On 6/17/24 6:22 PM, Eric Auger wrote: Hi Cédric, On 6/17/24 08:33, Cédric Le Goater wrote: Hello, The series starts with simple changes (patch 1-4). Two of which were initially sent by Joao in a series adding VFIO migration support with vIOMMU [1]. The changes following prepare VFIOContainer

Re: [PATCH v2 06/17] vfio/container: Simplify vfio_container_init()

2024-06-18 Thread Cédric Le Goater
On 6/17/24 4:25 PM, Eric Auger wrote: Hi Cédric, On 6/17/24 08:33, Cédric Le Goater wrote: Assign the base container VFIOAddressSpace 'space' pointer in vfio_address_space_insert(). OK I get it now. Maybe in the previous patch, say that the vfio_address_space_insert() will be enh

Re: [PATCH v2 05/17] vfio/container: Introduce vfio_address_space_insert()

2024-06-18 Thread Cédric Le Goater
On 6/17/24 4:04 PM, Eric Auger wrote: On 6/17/24 08:33, Cédric Le Goater wrote: It will ease future changes. Does it, really? Changed to : It prepares gound for a future change initializing the 'space' pointer of VFIOContainerBase. The goal is to replace vfio_container_init

Re: [PATCH v2 04/17] vfio/common: Extract vIOMMU code from vfio_sync_dirty_bitmap()

2024-06-18 Thread Cédric Le Goater
On 6/17/24 4:00 PM, Eric Auger wrote: Hi Cédric, On 6/17/24 08:33, Cédric Le Goater wrote: From: Avihai Horon Extract vIOMMU code from vfio_sync_dirty_bitmap() to a new function and restructure the code. This is done in preparation for optimizing vIOMMU deviice dirty page device fixed

Re: [PATCH v2 03/17] vfio/common: Move dirty tracking ranges update to helper

2024-06-18 Thread Cédric Le Goater
On 6/17/24 1:39 PM, Eric Auger wrote: Hi Cédric, On 6/17/24 08:33, Cédric Le Goater wrote: From: Joao Martins Separate the changes that updates the ranges from the listener, to s/updates/update fixed. make it reusable in preparation to expand its use to vIOMMU support. [ clg: - Rebased

Re: [PATCH v7 00/17] Add a host IOMMU device abstraction to check with vIOMMU

2024-06-17 Thread Cédric Le Goater
Hello Michael, On 6/5/24 10:30 AM, Zhenzhong Duan wrote: Hi, This series introduce a HostIOMMUDevice abstraction and sub-classes. Also HostIOMMUDeviceCaps structure in HostIOMMUDevice and a new interface between vIOMMU and HostIOMMUDevice. A HostIOMMUDevice is an abstraction for an assigned de

Re: [PATCH v4 3/8] HostIOMMUDevice: Introduce get_iova_ranges callback

2024-06-17 Thread Cédric Le Goater
On 6/14/24 11:52 AM, Eric Auger wrote: Introduce a new HostIOMMUDevice callback that allows to retrieve the usable IOVA ranges. Implement this callback in the legacy VFIO and IOMMUFD VFIO host iommu devices. This relies on the VFIODevice agent's base container iova_ranges resource. Signed-off-b

Re: [PATCH v2 01/17] vfio: Make vfio_devices_dma_logging_start() return bool

2024-06-17 Thread Cédric Le Goater
Hello Eric, On 6/17/24 1:31 PM, Eric Auger wrote: Hi Cédric, On 6/17/24 08:33, Cédric Le Goater wrote: Since vfio_devices_dma_logging_start() takes an 'Error **' argument, best practices suggest to return a bool. See the api/error.h Rules section. It will simplify potential chan

[PATCH v2 14/17] vfio/container: Remove VFIOContainerBase::ops

2024-06-16 Thread Cédric Le Goater
Instead, use VFIO_IOMMU_GET_CLASS() to get the class pointer. Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- include/hw/vfio/vfio-container-base.h | 1 - hw/vfio/common.c | 2 +- hw/vfio/container-base.c | 37 +-- hw

[PATCH v2 10/17] vfio/container: Discover IOMMU type before creating the container

2024-06-16 Thread Cédric Le Goater
() to extract the part doing the container initialization and move it under vfio_create_container(). Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- hw/vfio/container.c | 47 ++--- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git

[PATCH v2 11/17] vfio/container: Change VFIOContainerBase to use QOM

2024-06-16 Thread Cédric Le Goater
adjustments in the VFIO_IOMMU hierarchy. Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- include/hw/vfio/vfio-common.h | 4 include/hw/vfio/vfio-container-base.h | 12 +++- hw/vfio/container-base.c | 4 +++- hw/vfio/container.c

[PATCH v2 16/17] vfio/container: Introduce vfio_iommu_legacy_instance_init()

2024-06-16 Thread Cédric Le Goater
Just as we did for the VFIOContainerBase object, introduce an instance_init() handler for the legacy VFIOContainer object and do the specific initialization there. Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- hw/vfio/container.c | 9 - 1 file changed, 8 insertions

[PATCH v2 09/17] vfio/container: Introduce vfio_create_container()

2024-06-16 Thread Cédric Le Goater
This routine allocates the QEMU struct type representing the VFIO container. It is minimal currently and future changes will do more initialization. Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- hw/vfio/container.c | 19 +++ 1 file changed, 15 insertions(+), 4

[PATCH v2 17/17] vfio/container: Move vfio_container_destroy() to an instance_finalize() handler

2024-06-16 Thread Cédric Le Goater
vfio_container_destroy() clears the resources allocated VFIOContainerBase object. Now that VFIOContainerBase is a QOM object, add an instance_finalize() handler to do the cleanup. It will be called through object_unref(). Suggested-by: Zhenzhong Duan Signed-off-by: Cédric Le Goater --- include

[PATCH v2 15/17] vfio/container: Remove vfio_container_init()

2024-06-16 Thread Cédric Le Goater
It's now empty. Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- include/hw/vfio/vfio-container-base.h | 2 -- hw/vfio/container-base.c | 5 - hw/vfio/container.c | 3 --- hw/vfio/iommufd.c | 1 - 4 files change

[PATCH v2 12/17] vfio/container: Switch to QOM

2024-06-16 Thread Cédric Le Goater
Instead of allocating the container struct, create a QOM object of the appropriate type. Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- hw/vfio/container.c | 6 +++--- hw/vfio/iommufd.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/vfio

[PATCH v2 01/17] vfio: Make vfio_devices_dma_logging_start() return bool

2024-06-16 Thread Cédric Le Goater
lue can be saved in the migration stream when called from vfio_listener_log_global_stop(). Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- hw/vfio/common.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/comm

[PATCH v2 13/17] vfio/container: Introduce an instance_init() handler

2024-06-16 Thread Cédric Le Goater
This allows us to move the initialization code from vfio_container_init(), which we will soon remove. Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- hw/vfio/container-base.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/vfio

[PATCH v2 06/17] vfio/container: Simplify vfio_container_init()

2024-06-16 Thread Cédric Le Goater
Assign the base container VFIOAddressSpace 'space' pointer in vfio_address_space_insert(). To be noted that vfio_connect_container() will assign the 'space' pointer later in the execution flow. This should not have any consequence. Signed-off-by: Cédric Le Goater Reviewe

[PATCH v2 07/17] vfio/container: Modify vfio_get_iommu_type() to use a container fd

2024-06-16 Thread Cédric Le Goater
The 'container' pointer has no other use than its 'fd' attribute. Simplify the prototype to ease future changes. Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- hw/vfio/container.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/h

[PATCH v2 03/17] vfio/common: Move dirty tracking ranges update to helper

2024-06-16 Thread Cédric Le Goater
From: Joao Martins Separate the changes that updates the ranges from the listener, to make it reusable in preparation to expand its use to vIOMMU support. [ clg: - Rebased on upstream - Introduced vfio_dirty_tracking_update_range() ] Signed-off-by: Joao Martins Signed-off-by: Cédric Le

[PATCH v2 08/17] vfio/container: Introduce vfio_get_iommu_class_name()

2024-06-16 Thread Cédric Le Goater
Rework vfio_get_iommu_class() to return a literal class name instead of a class object. We will need this name to instantiate the object later on. Since the default case asserts, remove the error report as QEMU will simply abort before. Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan

[PATCH v2 04/17] vfio/common: Extract vIOMMU code from vfio_sync_dirty_bitmap()

2024-06-16 Thread Cédric Le Goater
: - Rebased on upstream ] Signed-off-by: Cédric Le Goater Reviewed-by: Zhenzhong Duan --- hw/vfio/common.c | 63 +--- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index

<    3   4   5   6   7   8   9   10   11   12   >