From: "Michael S. Tsirkin" <mst@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: lersek@redhat.com, qemu-devel@nongnu.org, kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 17/23] q35: implement high SMRAM
Date: Thu, 4 Jun 2015 14:50:53 +0200 [thread overview]
Message-ID: <20150604145021-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1433351328-23326-18-git-send-email-pbonzini@redhat.com>
On Wed, Jun 03, 2015 at 07:08:42PM +0200, Paolo Bonzini wrote:
> When H_SMRAME is 1, low memory at 0xa0000 is left alone by
> SMM, and instead the chipset maps the 0xa0000-0xbffff window at
> 0xfeda0000-0xfedbffff. This affects both the "non-SMM" view controlled
> by D_OPEN and the SMM view controlled by G_SMRAME, so add two new
> MemoryRegions and toggle the enabled/disabled state of all four
> in mch_update_smram.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/pci-host/q35.c | 35 +++++++++++++++++++++++++++++++----
> include/hw/pci-host/q35.h | 16 ++++++++--------
> 2 files changed, 39 insertions(+), 12 deletions(-)
>
> diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
> index 236d3f5..92804fe 100644
> --- a/hw/pci-host/q35.c
> +++ b/hw/pci-host/q35.c
> @@ -266,12 +266,29 @@ static void mch_update_pam(MCHPCIState *mch)
> static void mch_update_smram(MCHPCIState *mch)
> {
> PCIDevice *pd = PCI_DEVICE(mch);
> + bool h_smrame = (pd->config[MCH_HOST_BRIDGE_ESMRAMC] & MCH_HOST_BRIDGE_ESMRAMC_H_SMRAME);
>
> memory_region_transaction_begin();
> - memory_region_set_enabled(&mch->smram_region,
> - !(pd->config[MCH_HOST_BRIDGE_SMRAM] & SMRAM_D_OPEN));
> - memory_region_set_enabled(&mch->smram,
> - pd->config[MCH_HOST_BRIDGE_SMRAM] & SMRAM_G_SMRAME);
> +
> + if (pd->config[MCH_HOST_BRIDGE_SMRAM] & SMRAM_D_OPEN) {
> + /* Hide (!) low SMRAM if H_SMRAME = 1 */
> + memory_region_set_enabled(&mch->smram_region, h_smrame);
> + /* Show high SMRAM if H_SMRAME = 1 */
> + memory_region_set_enabled(&mch->open_high_smram, h_smrame);
> + } else {
> + /* Hide high SMRAM and low SMRAM */
> + memory_region_set_enabled(&mch->smram_region, true);
> + memory_region_set_enabled(&mch->open_high_smram, false);
> + }
> +
> + if (pd->config[MCH_HOST_BRIDGE_SMRAM] & SMRAM_G_SMRAME) {
> + memory_region_set_enabled(&mch->low_smram, !h_smrame);
> + memory_region_set_enabled(&mch->high_smram, h_smrame);
> + } else {
> + memory_region_set_enabled(&mch->low_smram, false);
> + memory_region_set_enabled(&mch->high_smram, false);
> + }
> +
> memory_region_transaction_commit();
> }
>
> @@ -400,6 +417,12 @@ static void mch_realize(PCIDevice *d, Error **errp)
> &mch->smram_region, 1);
> memory_region_set_enabled(&mch->smram_region, true);
>
> + memory_region_init_alias(&mch->open_high_smram, OBJECT(mch), "smram-open-high",
> + mch->ram_memory, 0xa0000, 0x20000);
> + memory_region_add_subregion_overlap(mch->system_memory, 0xfeda0000,
> + &mch->open_high_smram, 1);
> + memory_region_set_enabled(&mch->open_high_smram, false);
> +
> /* smram, as seen by SMM CPUs */
> memory_region_init(&mch->smram, OBJECT(mch), "smram", 1ull << 32);
> memory_region_set_enabled(&mch->smram, true);
> @@ -407,6 +430,10 @@ static void mch_realize(PCIDevice *d, Error **errp)
> mch->ram_memory, 0xa0000, 0x20000);
> memory_region_set_enabled(&mch->low_smram, true);
> memory_region_add_subregion(&mch->smram, 0xa0000, &mch->low_smram);
> + memory_region_init_alias(&mch->high_smram, OBJECT(mch), "smram-high",
> + mch->ram_memory, 0xa0000, 0x20000);
> + memory_region_set_enabled(&mch->high_smram, true);
> + memory_region_add_subregion(&mch->smram, 0xfeda0000, &mch->high_smram);
> object_property_add_const_link(qdev_get_machine(), "smram",
> OBJECT(&mch->smram), &error_abort);
>
> diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h
> index 17adeaa..0fff6a2 100644
> --- a/include/hw/pci-host/q35.h
> +++ b/include/hw/pci-host/q35.h
> @@ -52,8 +52,8 @@ typedef struct MCHPCIState {
> MemoryRegion *system_memory;
> MemoryRegion *address_space_io;
> PAMMemoryRegion pam_regions[13];
> - MemoryRegion smram_region;
> - MemoryRegion smram, low_smram;
> + MemoryRegion smram_region, open_high_smram;
> + MemoryRegion smram, low_smram, high_smram;
> PcPciInfo pci_info;
> ram_addr_t below_4g_mem_size;
> ram_addr_t above_4g_mem_size;
> @@ -127,7 +127,7 @@ typedef struct Q35PCIHost {
> #define MCH_HOST_BRIDGE_PAM_MASK ((uint8_t)0x3)
>
> #define MCH_HOST_BRIDGE_SMRAM 0x9d
> -#define MCH_HOST_BRIDGE_SMRAM_SIZE 1
> +#define MCH_HOST_BRIDGE_SMRAM_SIZE 2
> #define MCH_HOST_BRIDGE_SMRAM_DEFAULT ((uint8_t)0x2)
> #define MCH_HOST_BRIDGE_SMRAM_D_OPEN ((uint8_t)(1 << 6))
> #define MCH_HOST_BRIDGE_SMRAM_D_CLS ((uint8_t)(1 << 5))
> @@ -141,11 +141,11 @@ typedef struct Q35PCIHost {
> #define MCH_HOST_BRIDGE_UPPER_SYSTEM_BIOS_END 0x100000
>
> #define MCH_HOST_BRIDGE_ESMRAMC 0x9e
> -#define MCH_HOST_BRIDGE_ESMRAMC_H_SMRAME ((uint8_t)(1 << 6))
> -#define MCH_HOST_BRIDGE_ESMRAMC_E_SMERR ((uint8_t)(1 << 5))
> -#define MCH_HOST_BRIDGE_ESMRAMC_SM_CACHE ((uint8_t)(1 << 4))
> -#define MCH_HOST_BRIDGE_ESMRAMC_SM_L1 ((uint8_t)(1 << 3))
> -#define MCH_HOST_BRIDGE_ESMRAMC_SM_L2 ((uint8_t)(1 << 2))
> +#define MCH_HOST_BRIDGE_ESMRAMC_H_SMRAME ((uint8_t)(1 << 7))
> +#define MCH_HOST_BRIDGE_ESMRAMC_E_SMERR ((uint8_t)(1 << 6))
> +#define MCH_HOST_BRIDGE_ESMRAMC_SM_CACHE ((uint8_t)(1 << 5))
> +#define MCH_HOST_BRIDGE_ESMRAMC_SM_L1 ((uint8_t)(1 << 4))
> +#define MCH_HOST_BRIDGE_ESMRAMC_SM_L2 ((uint8_t)(1 << 3))
> #define MCH_HOST_BRIDGE_ESMRAMC_TSEG_SZ_MASK ((uint8_t)(0x3 << 1))
> #define MCH_HOST_BRIDGE_ESMRAMC_TSEG_SZ_1MB ((uint8_t)(0x0 << 1))
> #define MCH_HOST_BRIDGE_ESMRAMC_TSEG_SZ_2MB ((uint8_t)(0x1 << 1))
> --
> 2.4.1
>
next prev parent reply other threads:[~2015-06-04 12:51 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-03 17:08 [Qemu-devel] [PATCH v2 00/23] SMM improvements (chipset and TCG parts) Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 01/23] target-i386: introduce cpu_get_mem_attrs Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 02/23] target-i386: Use correct memory attributes for memory accesses Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 03/23] target-i386: Use correct memory attributes for ioport accesses Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 04/23] target-i386: mask NMIs on entry to SMM Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 05/23] target-i386: set G=1 in SMM big real mode selectors Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 06/23] target-i386: wake up processors that receive an SMI Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 07/23] pflash_cfi01: change big-endian property to BIT type Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 08/23] pflash_cfi01: change to new-style MMIO accessors Paolo Bonzini
2015-06-04 6:19 ` Peter Crosthwaite
2015-06-04 8:02 ` Paolo Bonzini
2015-06-04 12:51 ` Laszlo Ersek
2015-06-09 18:08 ` Richard Henderson
2015-06-09 18:47 ` Michael S. Tsirkin
2015-06-17 7:56 ` Paolo Bonzini
2015-06-17 8:22 ` Markus Armbruster
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 09/23] pflash_cfi01: add secure property Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 10/23] vl: allow full-blown QemuOpts syntax for -global Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 11/23] qom: add object_property_add_const_link Paolo Bonzini
2015-06-04 6:33 ` Peter Crosthwaite
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 12/23] vl: run "late" notifiers immediately Paolo Bonzini
2015-06-04 6:39 ` Peter Crosthwaite
2015-06-04 8:03 ` Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 13/23] target-i386: create a separate AddressSpace for each CPU Paolo Bonzini
2015-06-03 17:58 ` Peter Crosthwaite
2015-06-04 8:02 ` Paolo Bonzini
2015-06-04 12:48 ` Laszlo Ersek
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 14/23] hw/i386: add a separate region that tracks the SMRAME bit Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 15/23] target-i386: use memory API to implement SMRAM Paolo Bonzini
2015-06-04 7:19 ` Peter Crosthwaite
2015-06-04 8:05 ` Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 16/23] hw/i386: remove smram_update Paolo Bonzini
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 17/23] q35: implement high SMRAM Paolo Bonzini
2015-06-04 12:50 ` Michael S. Tsirkin [this message]
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 18/23] q35: fix ESMRAMC default Paolo Bonzini
2015-06-04 12:51 ` Michael S. Tsirkin
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 19/23] q35: add config space wmask for SMRAM and ESMRAMC Paolo Bonzini
2015-06-04 12:51 ` Michael S. Tsirkin
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 20/23] q35: implement SMRAM.D_LCK Paolo Bonzini
2015-06-04 12:51 ` Michael S. Tsirkin
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 21/23] q35: add test for SMRAM.D_LCK Paolo Bonzini
2015-06-04 12:52 ` Michael S. Tsirkin
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 22/23] q35: implement TSEG Paolo Bonzini
2015-06-04 12:53 ` Michael S. Tsirkin
2015-06-03 17:08 ` [Qemu-devel] [PATCH v2 23/23] ich9: implement SMI_LOCK Paolo Bonzini
2015-06-04 12:53 ` Michael S. Tsirkin
2015-06-03 17:41 ` [Qemu-devel] [PATCH v2 00/23] SMM improvements (chipset and TCG parts) Laszlo Ersek
2015-06-03 17:44 ` Paolo Bonzini
2015-06-04 12:54 ` 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=20150604145021-mutt-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=kraxel@redhat.com \
--cc=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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 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).