From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Chen, Yingwen" <yingwen.chen@intel.com>,
edk2-devel-groups-io <devel@edk2.groups.io>,
Phillip Goerl <phillip.goerl@oracle.com>,
"Yao, Jiewen" <jiewen.yao@intel.com>,
"Nakajima, Jun" <jun.nakajima@intel.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
edk2-rfc-groups-io <rfc@edk2.groups.io>,
Laszlo Ersek <lersek@redhat.com>,
Joao Marcal Lemos Martins <joao.m.martins@oracle.com>,
pbonzini@redhat.com
Subject: [PATCH QEMU 1/1] q35: use dedicated SMRAM at default SMM_BASE
Date: Fri, 16 Aug 2019 07:24:06 -0400 [thread overview]
Message-ID: <20190816112407.28180-2-imammedo@redhat.com> (raw)
In-Reply-To: <20190816112407.28180-1-imammedo@redhat.com>
it will allow us to hide sensetive SMM_BASE area from non SMM running env,
that will allow us to ensure that hotplugged CPU will run trusted
SMM BASE relocation code and we won't need to force all present CPUs
into SMM mode since we don not care about about 0x30000 content
in normal RAM address space.
it's a obviously a hack only to demo approach. for easy SMI initialization
on SMI entry point SMRAM is aliased in to hajaked normal RAM address space
at a0000.
Patch should be used with supplied SMBIOS patch, that drops
save/restore sequence and just inits SMI entry point.
to test to run:
qemu-system-x86_64 -M q35 -bios /path_to_seabios/out/bios.bin \
-nodefaults \
-chardev stdio,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
include/hw/pci-host/q35.h | 1 +
hw/pci-host/q35.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h
index 5ed77facd0..556ecb835a 100644
--- a/include/hw/pci-host/q35.h
+++ b/include/hw/pci-host/q35.h
@@ -55,6 +55,7 @@ typedef struct MCHPCIState {
MemoryRegion smram_region, open_high_smram;
MemoryRegion smram, low_smram, high_smram;
MemoryRegion tseg_blackhole, tseg_window;
+ MemoryRegion smbase, smram_alias;
Range pci_hole;
uint64_t below_4g_mem_size;
uint64_t above_4g_mem_size;
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 0a010be4cf..6c4c0f308c 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -574,6 +574,16 @@ static void mch_realize(PCIDevice *d, Error **errp)
memory_region_set_enabled(&mch->tseg_window, false);
memory_region_add_subregion(&mch->smram, mch->below_4g_mem_size,
&mch->tseg_window);
+
+ memory_region_init_ram(&mch->smm_base, OBJECT(mch), "SMM BASE", MCH_HOST_BRIDGE_SMRAM_C_SIZE, &error_fatal);
+ memory_region_set_enabled(&mch->smm_base, true);
+ memory_region_add_subregion(&mch->smram, 0x30000, &mch->smm_base);
+
+ memory_region_init_alias(&mch->smm_base_alias, OBJECT(mch), "smim_base_alias",
+ &mch->smm_base, 0, MCH_HOST_BRIDGE_SMRAM_C_SIZE);
+ memory_region_set_enabled(&mch->smm_base_alias, true);
+ memory_region_add_subregion_overlap(mch->system_memory, MCH_HOST_BRIDGE_SMRAM_C_BASE, &mch->smm_base_alias, 1);
+
object_property_add_const_link(qdev_get_machine(), "smram",
OBJECT(&mch->smram), &error_abort);
--
2.18.1
next prev parent reply other threads:[~2019-08-16 11:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 11:24 [POC QEMU PATCH 0/2] CPU hotplug: use dedicated SMRAM at 0x30000 in SMM address space Igor Mammedov
2019-08-16 11:24 ` Igor Mammedov [this message]
2019-08-16 11:24 ` [POC Seabios PATCH] seabios: use isolated SMM address space for relocation Igor Mammedov
2019-08-16 22:43 ` Boris Ostrovsky
2019-08-26 13:57 ` Igor Mammedov
2019-08-27 1:28 ` Boris Ostrovsky
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-list 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=20190816112407.28180-2-imammedo@redhat.com \
--to=devel@edk2.groups.io \
/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