qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>,
	qemu-devel <qemu-devel@nongnu.org>,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>
Cc: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v2 4/4] target-i386: Add NPT support
Date: Wed, 27 Jun 2018 14:14:14 +0200	[thread overview]
Message-ID: <dff77a32-ef43-192f-2e36-16067052a60e@redhat.com> (raw)
In-Reply-To: <fb0c41863e19c760eca91a71a86eb391147d083d.1522769774.git.jan.kiszka@web.de>

On 03/04/2018 17:36, Jan Kiszka wrote:
>  
> +static hwaddr get_hphys(CPUState *cs, hwaddr gphys, MMUAccessType access_type,
> +                        int *prot)
> +{
> +    CPUX86State *env = &X86_CPU(cs)->env;
> +    uint64_t rsvd_mask = PG_HI_RSVD_MASK;
> +    uint64_t ptep, pte;
> +    uint64_t exit_info_1 = 0;
> +    target_ulong pde_addr, pte_addr;
> +    uint32_t page_offset;
> +    int page_size;
> +
> +    if (likely(!(env->hflags & HF_NPT_MASK))) {
> +        return gphys;
> +    }

hflags are a somewhat limited resource.  Can this go in hflags2?

> 
> +
> +        env->nested_pg_mode = 0;
> +        if (env->cr[4] & CR4_PAE_MASK) {
> +            env->nested_pg_mode |= SVM_NPT_PAE;
> +        }
> +        if (env->hflags & HF_LMA_MASK) {
> +            env->nested_pg_mode |= SVM_NPT_LMA;
> +        }
> +        if (env->efer & MSR_EFER_NXE) {
> +            env->nested_pg_mode |= SVM_NPT_NXE;
> +        }
> +    }
> +

This needs to be migrated.  You can put it in a subsection, conditional
on hflags & HF_SVMI_MASK.

Also, do you need to flush the TLB unconditionally, even if CR0.PG is zero?

Otherwise looks good.  I have queued patches 1-3, but hopefully this one
can go in the next release too.  Sorry for the delayed review.

Paolo

  reply	other threads:[~2018-06-27 12:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-03 15:36 [Qemu-devel] [PATCH v2 0/4] target-i386: Enhance SVM support Jan Kiszka
2018-04-03 15:36 ` [Qemu-devel] [PATCH v2 1/4] target-i386: Add NMI interception to SVM Jan Kiszka
2018-04-03 15:36 ` [Qemu-devel] [PATCH v2 2/4] target-i386: Allow interrupt injection after STGI Jan Kiszka
2018-04-03 15:36 ` [Qemu-devel] [PATCH v2 3/4] target-i386: Mark cpu_vmexit noreturn Jan Kiszka
2018-04-03 15:36 ` [Qemu-devel] [PATCH v2 4/4] target-i386: Add NPT support Jan Kiszka
2018-06-27 12:14   ` Paolo Bonzini [this message]
2018-06-30  5:25     ` Jan Kiszka
2018-06-30  6:05       ` Paolo Bonzini
2018-06-30  6:07         ` Jan Kiszka
2018-04-03 15:48 ` [Qemu-devel] [PATCH v2 0/4] target-i386: Enhance SVM support no-reply
2018-05-22  7:12 ` Jan Kiszka

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=dff77a32-ef43-192f-2e36-16067052a60e@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=valentine.sinitsyn@gmail.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).