All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ning, Yu" <yu.ning@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Alexandro Sanchez Bach <alexandro@phi.nz>
Cc: "'Peter Maydell'" <peter.maydell@linaro.org>,
	"'Peter Krempa'" <pkrempa@redhat.com>,
	'Qemu-block' <qemu-block@nongnu.org>,
	'Libvirt' <libvir-list@redhat.com>,
	"'QEMU Developers'" <qemu-devel@nongnu.org>,
	"'László Érsek'" <lersek@redhat.com>,
	"'Justin Terry (VM)'" <juterry@microsoft.com>,
	"'Markus Armbruster'" <armbru@redhat.com>
Subject: Re: [Qemu-devel] Configuring pflash devices for OVMF firmware
Date: Fri, 1 Feb 2019 02:49:24 +0000	[thread overview]
Message-ID: <C29659EAAA3E0143B583467412621C605E408079@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <3ace3624-893b-82e1-3132-0dcd1896ec94@redhat.com>



> -----Original Message-----
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> Sent: Friday, February 1, 2019 7:55
> To: Alexandro Sanchez Bach <alexandro@phi.nz>; 'Markus Armbruster'
> <armbru@redhat.com>
> Cc: 'Peter Maydell' <peter.maydell@linaro.org>; 'Peter Krempa'
> <pkrempa@redhat.com>; 'Qemu-block' <qemu-block@nongnu.org>; 'Libvirt'
> <libvir-list@redhat.com>; 'QEMU Developers' <qemu-devel@nongnu.org>;
> 'László Érsek' <lersek@redhat.com>; 'Justin Terry (VM)'
> <juterry@microsoft.com>; Ning, Yu <yu.ning@intel.com>
> Subject: Re: [Qemu-devel] Configuring pflash devices for OVMF firmware
> 
> On 01/02/19 00:28, Alexandro Sanchez Bach wrote:
> > (CC'd Yu Ning @ Intel's HAXM team)
> >
> > Not sure, if I'm understanding the issue correctly, but isn't
> > `HAX_VM_IOCTL_SET_RAM2` with the `HAX_RAM_INFO_ROM` flag precisely
> > what you are looking for?
> >
> > More precisely, HAX_VM_IOCTL_SET_RAM2 maps an HVA range to a GPA
> > range, the HAX_RAM_INFO_ROM flag should allow only guest memory reads
> > to that range [1]. When the guest attempts to write, this should
> > trigger a VM exit that will be handled by QEMU.
> 
> The missing handling is in the hypervisor:
> 
>     if (ret == -EACCES) {
>         /*
>          * For some reason, during boot-up, Chrome OS guests make
> hundreds of
>          * attempts to write to GPAs close to 4GB, which are mapped into
> BIOS
>          * (read-only) and thus result in EPT violations.
>          * TODO: Handle this case properly.
>          */
>         hax_warning("%s: Unexpected EPT violation cause. Skipping
> instruction"
>                     " (len=%u)\n", __func__,
> vcpu->vmx.exit_instr_length);
>         advance_rip(vcpu);
>         return HAX_EXIT;
> }
> 
> > Also, this seems to be handled here:
> >
> https://github.com/qemu/qemu/blob/15bede554162dda822cd762c689edb6fa3
> 2b
> > 6e3b/target/i386/hax-mem.c#L205-L207
> 
> Right, though to be precise it should be changed to
> 
>      if (memory_region_is_rom(section->mr) ||
> 	 memory_region_is_romd(section->mr)) {         flags |=
> HAX_RAM_INFO_ROM;
>      }
> 
> for that to work.
> 

Thank you both for outlining the changes we have to make in order to support ROMD memory regions!  The only question is whether we should pass a new flag to HAX_VM_IOCTL_SET_RAM2 for ROMD, so the hypervisor could respond differently to writes to ROM and ROMD regions.  Would that be useful at all?  What would happen if HAXM asked QEMU to emulate a write to ROM?

HAXM didn't implement ROMD support at first, because the guests we tested could boot without it (including Chrome OS).  Now that this feature has become more popular (and we want to be able to boot OVMF), I think it's time to get it done.  I'd like to get to it after the Lunar New Year holidays, but if anyone can finish it sooner, I'll be happy to merge their patch into HAXM.

-Yu

  reply	other threads:[~2019-02-01  2:49 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 15:03 [Qemu-devel] Configuring pflash devices for OVMF firmware Markus Armbruster
2019-01-28  7:58 ` Laszlo Ersek
2019-01-28 10:39 ` Peter Maydell
2019-01-28 12:40   ` [Qemu-devel] [libvirt] " Gerd Hoffmann
2019-01-28 13:06     ` Peter Maydell
2019-01-28 14:55       ` Laszlo Ersek
2019-01-28 14:58         ` Peter Maydell
2019-01-28 15:03           ` Laszlo Ersek
2019-01-30  7:36       ` Markus Armbruster
2019-01-30  8:00         ` Gerd Hoffmann
2019-01-30  7:24   ` [Qemu-devel] " Markus Armbruster
2019-01-30 15:24     ` Peter Maydell
2019-01-30 16:44       ` Laszlo Ersek
2019-01-30 17:24         ` Peter Maydell
2019-01-31  8:52           ` Markus Armbruster
2019-01-31 10:01             ` Peter Maydell
2019-01-31 10:24               ` Markus Armbruster
2019-01-31 10:34                 ` Peter Maydell
2019-01-31 12:05                   ` Markus Armbruster
2019-01-30 14:13   ` Markus Armbruster
2019-01-30 14:33     ` Paolo Bonzini
2019-01-30 16:38       ` Laszlo Ersek
2019-01-31  8:33         ` Markus Armbruster
2019-01-31  9:19           ` Paolo Bonzini
2019-01-31  9:37             ` Markus Armbruster
2019-01-31 12:02               ` Laszlo Ersek
2019-01-31 12:10               ` Paolo Bonzini
2019-01-31 12:51                 ` Markus Armbruster
2019-01-31  8:40       ` Markus Armbruster
2019-01-31  9:19         ` Paolo Bonzini
2019-01-31  9:41           ` Markus Armbruster
2019-01-31 10:12             ` Paolo Bonzini
2019-01-31 12:12               ` Markus Armbruster
2019-01-31 22:57                 ` Paolo Bonzini
2019-01-31 23:28                   ` Alexandro Sanchez Bach
2019-01-31 23:54                     ` Paolo Bonzini
2019-02-01  2:49                       ` Ning, Yu [this message]
2019-02-04 10:00                         ` Paolo Bonzini
2019-02-01  8:58                   ` Markus Armbruster
2019-01-31 11:57           ` Laszlo Ersek
2019-02-19  7:19       ` Markus Armbruster
2019-02-22 13:28         ` Markus Armbruster
2019-02-07  9:30 ` Markus Armbruster
2019-02-07 12:31   ` Laszlo Ersek
2019-02-07 13:49     ` Markus Armbruster

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=C29659EAAA3E0143B583467412621C605E408079@SHSMSX101.ccr.corp.intel.com \
    --to=yu.ning@intel.com \
    --cc=alexandro@phi.nz \
    --cc=armbru@redhat.com \
    --cc=juterry@microsoft.com \
    --cc=lersek@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 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.