All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: xen-devel@lists.xenproject.org
Cc: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>
Subject: [PATCH v2 7/9] IOMMU/AMD: wire common device reserved memory API
Date: Wed,  6 Jul 2022 17:32:12 +0200	[thread overview]
Message-ID: <457056cbc6dcc00958b1f4e0cad35121e0cd1557.1657121519.git-series.marmarek@invisiblethingslab.com> (raw)
In-Reply-To: <cover.991b72d99d9e5bd4c2c76791ceb49f1056ce5d1c.1657121519.git-series.marmarek@invisiblethingslab.com>

Register common device reserved memory similar to how ivmd= parameter is
handled.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/drivers/passthrough/amd/iommu_acpi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index ac6835225bae..2a4896c05442 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -1078,6 +1078,20 @@ static inline bool_t is_ivmd_block(u8 type)
             type == ACPI_IVRS_TYPE_MEMORY_IOMMU);
 }
 
+static int __init cf_check add_one_extra_ivmd(xen_pfn_t start, xen_ulong_t nr, u32 id, void *ctxt)
+{
+    struct acpi_ivrs_memory ivmd;
+
+    ivmd.start_address = start << PAGE_SHIFT;
+    ivmd.memory_length = nr << PAGE_SHIFT;
+    ivmd.header.flags = ACPI_IVMD_UNITY |
+                        ACPI_IVMD_READ | ACPI_IVMD_WRITE;
+    ivmd.header.length = sizeof(ivmd);
+    ivmd.header.device_id = id;
+    ivmd.header.type = ACPI_IVRS_TYPE_MEMORY_ONE;
+    return parse_ivmd_block(&ivmd);
+}
+
 static int __init cf_check parse_ivrs_table(struct acpi_table_header *table)
 {
     const struct acpi_ivrs_header *ivrs_block;
@@ -1121,6 +1135,8 @@ static int __init cf_check parse_ivrs_table(struct acpi_table_header *table)
         AMD_IOMMU_DEBUG("IVMD: %u command line provided entries\n", nr_ivmd);
     for ( i = 0; !error && i < nr_ivmd; ++i )
         error = parse_ivmd_block(user_ivmds + i);
+    if ( !error )
+        error = iommu_get_extra_reserved_device_memory(add_one_extra_ivmd, NULL);
 
     /* Each IO-APIC must have been mentioned in the table. */
     for ( apic = 0; !error && iommu_intremap && apic < nr_ioapics; ++apic )
-- 
git-series 0.9.1


  parent reply	other threads:[~2022-07-06 15:33 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06 15:32 [PATCH v2 0/9] Add Xue - console over USB 3 Debug Capability Marek Marczykowski-Górecki
2022-07-06 15:32 ` [PATCH v2 1/9] drivers/char: Add support for Xue USB3 debugger Marek Marczykowski-Górecki
2022-07-08  2:11   ` Marek Marczykowski-Górecki
2022-07-12 15:59   ` Jan Beulich
2022-07-18 10:45     ` Marek Marczykowski-Górecki
2022-07-18 10:55       ` Jan Beulich
2022-07-12 16:06   ` Jan Beulich
2022-07-14  6:05   ` Jan Beulich
2022-07-16 22:40     ` Marek Marczykowski-Górecki
2022-07-14 11:58   ` Jan Beulich
2022-07-16 23:32     ` Marek Marczykowski-Górecki
2022-07-20 20:12     ` Marek Marczykowski-Górecki
2022-07-21 10:25       ` Jan Beulich
2022-07-06 15:32 ` [PATCH v2 2/9] xue: reset XHCI ports when initializing dbc Marek Marczykowski-Górecki
2022-07-13  7:19   ` Jan Beulich
2022-07-06 15:32 ` [PATCH v2 3/9] xue: add support for selecting specific xhci Marek Marczykowski-Górecki
2022-07-13  7:24   ` Jan Beulich
2022-07-06 15:32 ` [PATCH v2 4/9] console: support multiple serial console simultaneously Marek Marczykowski-Górecki
2022-07-13  9:39   ` Jan Beulich
2022-07-18 12:48     ` Marek Marczykowski-Górecki
2022-07-18 14:37       ` Jan Beulich
2022-07-06 15:32 ` [PATCH v2 5/9] IOMMU: add common API for device reserved memory Marek Marczykowski-Górecki
2022-07-14 10:17   ` Jan Beulich
2022-07-18 10:53     ` Marek Marczykowski-Górecki
2022-07-18 11:14       ` Jan Beulich
2022-07-18 11:03     ` Marek Marczykowski-Górecki
2022-07-18 11:15       ` Jan Beulich
2022-07-06 15:32 ` [PATCH v2 6/9] IOMMU/VT-d: wire common device reserved memory API Marek Marczykowski-Górecki
2022-07-06 15:32 ` Marek Marczykowski-Górecki [this message]
2022-07-14 10:22   ` [PATCH v2 7/9] IOMMU/AMD: " Jan Beulich
2022-07-18 11:35     ` Marek Marczykowski-Górecki
2022-07-18 11:44       ` Jan Beulich
2022-07-06 15:32 ` [PATCH v2 8/9] xue: mark DMA buffers as reserved for the device Marek Marczykowski-Górecki
2022-07-14 11:51   ` Jan Beulich
2022-07-18 13:15     ` Marek Marczykowski-Górecki
2022-07-20 20:17     ` Marek Marczykowski-Górecki
2022-07-21 10:30       ` Jan Beulich
2022-07-06 15:32 ` [PATCH v2 9/9] xue: allow driving the rest of XHCI by a domain while Xen uses DbC Marek Marczykowski-Górecki
2022-07-14 12:06   ` Jan Beulich
2022-07-18 12:54     ` Marek Marczykowski-Górecki
2022-07-18 15:07       ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=457056cbc6dcc00958b1f4e0cad35121e0cd1557.1657121519.git-series.marmarek@invisiblethingslab.com \
    --to=marmarek@invisiblethingslab.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.