From: Laurent Vivier <lvivier@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
jasowang@redhat.com, mst@redhat.com,
"David Hildenbrand" <david@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
marcandre.lureau@redhat.com, eric.auger@redhat.com,
"Peter Xu" <peterx@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>
Subject: [PATCH 2/2] tpm_crb: mark memory as protected
Date: Tue, 20 Jun 2023 21:50:54 +0200 [thread overview]
Message-ID: <20230620195054.23929-3-lvivier@redhat.com> (raw)
In-Reply-To: <20230620195054.23929-1-lvivier@redhat.com>
This memory is not correctly aligned and cannot be registered
by vDPA and VFIO.
An error is reported for vhost-vdpa case:
qemu-kvm: vhost_vdpa_listener_region_add received unaligned region
To make it ignored by VFIO and vDPA devices, mark it as RAM_PROTECTED.
The RAM_PROTECTED flag has been introduced to skip memory
region that looks like RAM but is not accessible via normal
mechanims, including DMA.
See 56918a126a ("memory: Add RAM_PROTECTED flag to skip IOMMU mappings")
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2141965
cc: peter.maydell@linaro.org
cc: marcandre.lureau@redhat.com
cc: eric.auger@redhat.com
cc: mst@redhat.com
cc: jasowang@redhat.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
hw/tpm/tpm_crb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
index ea930da545af..0a93c488f2fa 100644
--- a/hw/tpm/tpm_crb.c
+++ b/hw/tpm/tpm_crb.c
@@ -296,7 +296,7 @@ static void tpm_crb_realize(DeviceState *dev, Error **errp)
memory_region_init_io(&s->mmio, OBJECT(s), &tpm_crb_memory_ops, s,
"tpm-crb-mmio", sizeof(s->regs));
- memory_region_init_ram(&s->cmdmem, OBJECT(s),
+ memory_region_init_ram_protected(&s->cmdmem, OBJECT(s),
"tpm-crb-cmd", CRB_CTRL_CMD_SIZE, errp);
memory_region_add_subregion(get_system_memory(),
--
2.41.0
next prev parent reply other threads:[~2023-06-20 19:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 19:50 [PATCH 0/2] vhost-vdpa: skip TPM CRB memory section Laurent Vivier
2023-06-20 19:50 ` [PATCH 1/2] memory: introduce memory_region_init_ram_protected() Laurent Vivier
2023-06-21 12:27 ` Stefan Berger
2023-06-22 13:05 ` David Hildenbrand
2023-06-22 13:16 ` Peter Maydell
2023-06-20 19:50 ` Laurent Vivier [this message]
2023-06-21 9:13 ` [PATCH 2/2] tpm_crb: mark memory as protected David Hildenbrand
2023-06-22 12:59 ` Laurent Vivier
2023-06-22 13:05 ` David Hildenbrand
2023-06-21 12:29 ` Stefan Berger
2023-06-22 13:05 ` David Hildenbrand
2023-06-22 13:12 ` Peter Maydell
2023-06-22 13:39 ` Laurent Vivier
2023-06-22 13:53 ` Peter Maydell
2023-07-04 3:07 ` Jason Wang
2023-07-04 6:45 ` Laurent Vivier
2023-06-21 15:32 ` [PATCH 0/2] vhost-vdpa: skip TPM CRB memory section Peter Xu
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=20230620195054.23929-3-lvivier@redhat.com \
--to=lvivier@redhat.com \
--cc=david@redhat.com \
--cc=eric.auger@redhat.com \
--cc=jasowang@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.vnet.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).