Re: [PATCH v3 0/8] util: Introduce qemu_get_runtime_dir()

2024-02-17 Thread Akihiko Odaki
Hi, This patch series has been forgotten for a while but can still be applied. Can anyone review it? Regards, Akihiko Odaki On 2023/09/21 16:54, Akihiko Odaki wrote: qemu_get_runtime_dir() returns a dynamically allocated directory path that is appropriate for storing runtime files. It corres

[PATCH v5 10/11] hw/pci: Rename has_power to enabled

2024-02-17 Thread Akihiko Odaki
The renamed state will not only represent powering state of PFs, but also represent SR-IOV VF enablement in the future. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci.h| 7 ++- include/hw/pci/pci_device.h | 2 +- hw/pci/pci.c| 14 +++--- hw/pci/pci_host

[PATCH v5 06/11] hw/qdev: Remove opts member

2024-02-17 Thread Akihiko Odaki
It is no longer used. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- include/hw/qdev-core.h | 4 hw/core/qdev.c | 1 - system/qdev-monitor.c | 12 +++- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/hw/qdev-core.h b/include/

[PATCH v5 02/11] pcie_sriov: Validate NumVFs

2024-02-17 Thread Akihiko Odaki
The guest may write NumVFs greater than TotalVFs and that can lead to buffer overflow in VF implementations. Cc: qemu-sta...@nongnu.org Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)") Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 3 +++ 1 file chan

[PATCH v5 11/11] pcie_sriov: Reuse SR-IOV VF device instances

2024-02-17 Thread Akihiko Odaki
Disable SR-IOV VF devices by reusing code to power down PCI devices instead of removing them when the guest requests to disable VFs. This allows to realize devices and report VF realization errors at PF realization time. Signed-off-by: Akihiko Odaki --- docs/pcie_sriov.txt | 8 ++-- in

[PATCH v5 04/11] hw/pci: Determine if rombar is explicitly enabled

2024-02-17 Thread Akihiko Odaki
vfio determines if rombar is explicitly enabled by inspecting QDict. Inspecting QDict is not nice because QDict is untyped and depends on the details on the external interface. Add an infrastructure to determine if rombar is explicitly enabled to hw/pci. Signed-off-by: Akihiko Odaki --- include/

[PATCH v5 09/11] hw/pci: Always call pcie_sriov_pf_reset()

2024-02-17 Thread Akihiko Odaki
Call pcie_sriov_pf_reset() from pci_do_device_reset() just as we do for msi_reset() and msix_reset() to prevent duplicating code for each SR-IOV PF. Signed-off-by: Akihiko Odaki --- hw/net/igb.c | 2 -- hw/nvme/ctrl.c | 4 hw/pci/pci.c | 1 + 3 files changed, 1 insertion(+), 6 deletions

[PATCH v5 03/11] hw/pci: Use -1 as a default value for rombar

2024-02-17 Thread Akihiko Odaki
Currently there is no way to distinguish the case that rombar is explicitly specified as 1 and the case that rombar is not specified. Set rombar -1 by default to distinguish these cases just as it is done for addr and romsize. It was confirmed that changing the default value to -1 will not change

[PATCH v5 08/11] pcie_sriov: Do not reset NumVFs after disabling VFs

2024-02-17 Thread Akihiko Odaki
The spec does not NumVFs is reset after disabling VFs except when resetting the PF. Clearing it is guest visible and out of spec, even though Linux doesn't rely on this value being preserved, so we never noticed. Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)"

[PATCH v5 05/11] vfio: Avoid inspecting option QDict for rombar

2024-02-17 Thread Akihiko Odaki
Use pci_rom_bar_explicitly_enabled() to determine if rombar is explicitly enabled. Signed-off-by: Akihiko Odaki --- hw/vfio/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 4fa387f0430d..647f15b2a060 100644 --- a/hw/vfio/pci.c +++ b/

[PATCH v5 07/11] pcie_sriov: Reset SR-IOV extended capability

2024-02-17 Thread Akihiko Odaki
pcie_sriov_pf_disable_vfs() is called when resetting the PF, but it only disables VFs and does not reset SR-IOV extended capability, leaking the state and making the VF Enable register inconsistent with the actual state. Replace pcie_sriov_pf_disable_vfs() with pcie_sriov_pf_reset(), which does no

[PATCH v5 01/11] hw/nvme: Use pcie_sriov_num_vfs()

2024-02-17 Thread Akihiko Odaki
nvme_sriov_pre_write_ctrl() used to directly inspect SR-IOV configurations to know the number of VFs being disabled due to SR-IOV configuration writes, but the logic was flawed and resulted in out-of-bound memory access. It assumed PCI_SRIOV_NUM_VF always has the number of currently enabled VFs, b

[PATCH v5 00/11] hw/pci: SR-IOV related fixes and improvements

2024-02-17 Thread Akihiko Odaki
I submitted a RFC series[1] to add support for SR-IOV emulation to virtio-net-pci. During the development of the series, I fixed some trivial bugs and made improvements that I think are independently useful. This series extracts those fixes and improvements from the RFC series. [1]: https://patche

Re: [PATCH] scsi: megasas: Internal cdbs have 16-byte length

2024-02-17 Thread Guenter Roeck
On 2/17/24 01:06, Michael Tokarev wrote: 28.02.2023 20:11, Guenter Roeck wrote: Host drivers do not necessarily set cdb_len in megasas io commands. With commits 6d1511cea0 ("scsi: Reject commands if the CDB length exceeds buf_len") and fe9d8927e2 ("scsi: Add buf_len parameter to scsi_req_new()")

Re: [PATCH v4 5/9] pcie_sriov: Validate NumVFs

2024-02-17 Thread Akihiko Odaki
On 2024/02/15 0:55, Michael S. Tsirkin wrote: On Wed, Feb 14, 2024 at 06:53:43PM +0300, Michael Tokarev wrote: Nope, I don't remember how to request a CVE ;) https://www.qemu.org/contribute/security-process/ Thanks, I requested CVEs with the form. QEMU doesn't have any list of features with

[PATCH v2] tests/cdrom-test: Add cdrom test for LoongArch virt machine

2024-02-17 Thread Bibo Mao
The cdrom test skips to execute on LoongArch system with command "make check", this patch enables cdrom test for LoongArch virt machine platform. With this patch, cdrom test passes to run on LoongArch virt machine type. Signed-off-by: Bibo Mao --- Add virtio-blk-pci checking since LoongArch virt

Re: [PATCH] scsi: megasas: Internal cdbs have 16-byte length

2024-02-17 Thread Michael Tokarev
28.02.2023 20:11, Guenter Roeck wrote: Host drivers do not necessarily set cdb_len in megasas io commands. With commits 6d1511cea0 ("scsi: Reject commands if the CDB length exceeds buf_len") and fe9d8927e2 ("scsi: Add buf_len parameter to scsi_req_new()"), this results in failures to boot Linux f