From: Igor Mammedov <imammedo@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v8 2/5] tpm: implement virtual memory device for TPM PPI
Date: Tue, 17 Jul 2018 16:36:43 +0200 [thread overview]
Message-ID: <20180717163643.2ebe04a7@redhat.com> (raw)
In-Reply-To: <0d565394-3b13-f290-bf2c-5807f403ead7@redhat.com>
On Tue, 17 Jul 2018 15:04:25 +0200
Laszlo Ersek <lersek@redhat.com> wrote:
> On 07/17/18 12:39, Marc-André Lureau wrote:
> > Hi
> >
> > On Tue, Jul 17, 2018 at 12:03 PM, Igor Mammedov <imammedo@redhat.com> wrote:
> >> On Mon, 16 Jul 2018 14:59:45 +0200
> >> Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
> >>
> >>> From: Stefan Berger <stefanb@linux.vnet.ibm.com>
> >>>
> >>> Implement a virtual memory device for the TPM Physical Presence interface.
> >>> The memory is located at 0xFED45000 and used by ACPI to send messages to the
> >>> firmware (BIOS) and by the firmware to provide parameters for each one of
> >>> the supported codes.
> >> ...
> >> another question wrt E820 table, is firmware putting a reservation record
> >> for this RAM area overlay or should we do it QEMU?
>
> What OS requires this memmap entry?
>
> > There doesn't seem to be any reservation done in ovmf, or on my
> > laptop.
>
> Relevant point, about your laptop.
>
> > I also wonder if it should be done.
>
> IMO: no, it shouldn't.
>
> > And how OS deal with that today (/proc/iomem is correct).
> >
> > Laszlo, any idea?
>
> In my experience, exposing such MMIO areas that belong to *platform*
> devices, in the UEFI memory map, is an inconsistent practice. I can list
> at least four different cases:
>
> (1) A UEFI runtime driver is using the MMIO area for providing a UEFI
> runtime service. In this case, the firmware must expose the area as
> "MMIO" type memory, and set the "runtime" attribute on it. In response,
> the OS will map the area with virtual addresses, directly in response to
> the memmap entry.
>
> (2) A firmware SMM driver is using the MMIO area for providing a
> privileged part of a UEFI runtime service. Because SMM uses its own page
> table anyway (protected from the OS), advertizing the area in the UEFI
> memmap is unneeded. It can simply be left as a gap.
>
> (3) Linux requires the firmware to cover every MMCONFIG area (each of
> which belongs to a PCIe host bridge, which is a platform device) with a
> "reserved" type memmap entry. To me this looks like an outlier, although
> I *very* vaguely recall that some spec recommended this.
>
> Ah, right, the PCI Firmware Specification says, under "MCFG Table
> Description": "*If* the operating system does not natively comprehend
> reserving the MMCFG region, the MMCFG region must be reserved by
> firmware." (Emphasis mine.) In other words, this is a provision in the
> PCI firmware spec so that platform firmware paper over the fact that the
> ACPI subsystem in the OS kernel is limited. Linux, given that it
> understand MCFG just fine, totally should not *require* the firmware to
> reserve this region in the UEFI memory map as well. Anyway, Linux does
> require it (incorrectly, in my opinion), so OVMF complies.
>
> (4) To my understanding, unless given Linux or Windows quirks like (3),
> or UEFI runtime drivers like (1), we shouldn't expose, in the UEFI
> memmap, MMIO areas related to platform devices. In particular, the
> "MMIO" type memory *without* the "runtime" attribute (see (1)) should
> never be used in the UEFI memmap (and edk2 will never create such
> entries) -- the UEFI spec says that all such areas (resources) should be
> communicated through ACPI tables ("All system memory-mapped IO
> information should come from ACPI tables" -- see EfiMemoryMappedIO in
> "Table 26. Memory Type Usage after ExitBootServices()").
>
>
> In brief, the TPM PPI MMIO area should just be left as a gap in the UEFI
> memmap. (Case (4) applies.)
so I guess we are good as the patch should fit the bill for (4)
>
> Thanks,
> Laszlo
next prev parent reply other threads:[~2018-07-17 14:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-16 12:59 [Qemu-devel] [PATCH v8 0/5] Add support for TPM Physical Presence interface Marc-André Lureau
2018-07-16 12:59 ` [Qemu-devel] [PATCH v8 1/5] tpm: add a "ppi" boolean property Marc-André Lureau
2018-07-16 12:59 ` [Qemu-devel] [PATCH v8 2/5] tpm: implement virtual memory device for TPM PPI Marc-André Lureau
2018-07-16 14:44 ` Igor Mammedov
2018-07-16 14:56 ` Marc-André Lureau
2018-07-17 7:59 ` Igor Mammedov
2018-07-17 10:22 ` Marc-André Lureau
2018-07-17 14:34 ` Igor Mammedov
2018-07-17 10:03 ` Igor Mammedov
2018-07-17 10:39 ` Marc-André Lureau
2018-07-17 13:04 ` Laszlo Ersek
2018-07-17 14:36 ` Igor Mammedov [this message]
2018-07-17 14:46 ` Igor Mammedov
2018-07-16 12:59 ` [Qemu-devel] [PATCH v8 3/5] acpi: add fw_cfg file for TPM and PPI virtual memory device Marc-André Lureau
2018-07-16 14:46 ` Igor Mammedov
2018-07-18 8:16 ` Igor Mammedov
2018-07-16 12:59 ` [Qemu-devel] [PATCH v8 4/5] acpi: build TPM Physical Presence interface Marc-André Lureau
2018-07-17 12:16 ` Igor Mammedov
2018-07-16 12:59 ` [Qemu-devel] [PATCH v8 5/5] PoC: tpm: add ACPI memory clear interface Marc-André Lureau
2018-07-17 7:57 ` Igor Mammedov
2018-07-17 15:39 ` Marc-André Lureau
2018-07-23 11:08 ` Igor Mammedov
2018-07-23 11:16 ` Marc-André Lureau
2018-07-16 16:41 ` [Qemu-devel] [PATCH v8 0/5] Add support for TPM Physical Presence interface Michael S. Tsirkin
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=20180717163643.2ebe04a7@redhat.com \
--to=imammedo@redhat.com \
--cc=ehabkost@redhat.com \
--cc=lersek@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--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).