[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 1/2] s390x/pci: add support for guests that request direct
From: |
Thomas Huth |
Subject: |
Re: [PATCH v3 1/2] s390x/pci: add support for guests that request direct mapping |
Date: |
Mon, 27 Jan 2025 15:13:45 +0100 |
User-agent: |
Mozilla Thunderbird |
On 24/01/2025 21.21, Matthew Rosato wrote:
When receiving a guest mpcifc(4) or mpcifc(6) instruction without the T
bit set, treat this as a request to perform direct mapping instead of
address translation. In order to facilitate this, pin the entirety of
guest memory into the host iommu.
Pinning for the direct mapping case is handled via vfio and its memory
listener. Additionally, ram discard settings are inherited from vfio:
coordinated discards (e.g. virtio-mem) are allowed while uncoordinated
discards (e.g. virtio-balloon) are disabled.
Subsequent guest DMA operations are all expected to be of the format
guest_phys+sdma, allowing them to be used as lookup into the host
iommu table.
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
...
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index e386d75d58..4c108fa8c4 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -16,6 +16,7 @@
#include "exec/memory.h"
#include "qemu/error-report.h"
#include "system/hw_accel.h"
+#include "hw/boards.h"
#include "hw/pci/pci_device.h"
#include "hw/s390x/s390-pci-inst.h"
#include "hw/s390x/s390-pci-bus.h"
@@ -1008,17 +1009,25 @@ static int reg_ioat(CPUS390XState *env,
S390PCIBusDevice *pbdev, ZpciFib fib,
}
/* currently we only support designation type 1 with translation */
- if (!(dt == ZPCI_IOTA_RTTO && t)) {
+ if (t && !(dt == ZPCI_IOTA_RTTO)) {
While you're at it, you could change that "!(dt == ZPCI_IOTA_RTTO)" into
"dt != ZPCI_IOTA_RTTO".
error_report("unsupported ioat dt %d t %d", dt, t);
s390_program_interrupt(env, PGM_OPERAND, ra);
return -EINVAL;
+ } else if (!t && !pbdev->rtr_allowed) {
+ error_report("relaxed translation not allowed");
Not sure, but maybe better use qemu_log_mask(LOG_GUEST_ERROR, ...) instead?
+ s390_program_interrupt(env, PGM_OPERAND, ra);
+ return -EINVAL;
}
Thomas