qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [Qemu-devel] [PATCH v2 2/3] target/ppc/kvm: don't pass cpu to kvm_get_smmu_info()
Date: Mon, 2 Jul 2018 16:01:05 +1000	[thread overview]
Message-ID: <20180702060105.GA3422@umbus.fritz.box> (raw)
In-Reply-To: <153026571205.394407.1842744312813398945.stgit@bahia.lan>

[-- Attachment #1: Type: text/plain, Size: 3272 bytes --]

On Fri, Jun 29, 2018 at 11:48:32AM +0200, Greg Kurz wrote:
11;rgb:ffff/ffff/ffff> In a future patch the machine code will need to retrieve the MMU
> information from KVM during machine initialization before the CPUs
> are created.
> 
> Actually, KVM_PPC_GET_SMMU_INFO is a VM class ioctl, and thus, we
> don't need to have a CPU object around. We just need for KVM to
> be initialized and use the kvm_state global. This patch just does
> that.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

Applied to ppc-for-3.0.

> ---
> v2: - fallback code was dropped by a previous patch
> ---
>  target/ppc/kvm.c |   17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index b6000f12b98f..9211ee2ee1a0 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -248,19 +248,19 @@ static int kvm_booke206_tlb_init(PowerPCCPU *cpu)
>  
>  
>  #if defined(TARGET_PPC64)
> -static void kvm_get_smmu_info(PowerPCCPU *cpu, struct kvm_ppc_smmu_info *info,
> -                              Error **errp)
> +static void kvm_get_smmu_info(struct kvm_ppc_smmu_info *info, Error **errp)
>  {
> -    CPUState *cs = CPU(cpu);
>      int ret;
>  
> -    if (!kvm_check_extension(cs->kvm_state, KVM_CAP_PPC_GET_SMMU_INFO)) {
> +    assert(kvm_state != NULL);
> +
> +    if (!kvm_check_extension(kvm_state, KVM_CAP_PPC_GET_SMMU_INFO)) {
>          error_setg(errp, "KVM doesn't expose the MMU features it supports");
>          error_append_hint(errp, "Consider switching to a newer KVM\n");
>          return;
>      }
>  
> -    ret = kvm_vm_ioctl(cs->kvm_state, KVM_PPC_GET_SMMU_INFO, info);
> +    ret = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_SMMU_INFO, info);
>      if (ret == 0) {
>          return;
>      }
> @@ -326,14 +326,13 @@ target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
>  
>  bool kvmppc_hpt_needs_host_contiguous_pages(void)
>  {
> -    PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
>      static struct kvm_ppc_smmu_info smmu_info;
>  
>      if (!kvm_enabled()) {
>          return false;
>      }
>  
> -    kvm_get_smmu_info(cpu, &smmu_info, &error_fatal);
> +    kvm_get_smmu_info(&smmu_info, &error_fatal);
>      return !!(smmu_info.flags & KVM_PPC_PAGE_SIZES_REAL);
>  }
>  
> @@ -348,7 +347,7 @@ void kvm_check_mmu(PowerPCCPU *cpu, Error **errp)
>          return;
>      }
>  
> -    kvm_get_smmu_info(cpu, &smmu_info, &local_err);
> +    kvm_get_smmu_info(&smmu_info, &local_err);
>      if (local_err) {
>          error_propagate(errp, local_err);
>          return;
> @@ -2091,7 +2090,7 @@ uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift)
>  
>      /* Find the largest hardware supported page size that's less than
>       * or equal to the (logical) backing page size of guest RAM */
> -    kvm_get_smmu_info(POWERPC_CPU(first_cpu), &info, &error_fatal);
> +    kvm_get_smmu_info(&info, &error_fatal);
>      rampagesize = qemu_getrampagesize();
>      best_page_shift = 0;
>  
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-07-02  6:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  9:48 [Qemu-devel] [PATCH v2 0/3] spapr: fix regression with older machine types Greg Kurz
2018-06-29  9:48 ` [Qemu-devel] [PATCH v2 1/3] target/ppc/kvm: get rid of kvm_get_fallback_smmu_info() Greg Kurz
2018-07-02  5:54   ` David Gibson
2018-06-29  9:48 ` [Qemu-devel] [PATCH v2 2/3] target/ppc/kvm: don't pass cpu to kvm_get_smmu_info() Greg Kurz
2018-07-02  6:01   ` David Gibson [this message]
2018-06-29  9:48 ` [Qemu-devel] [PATCH v2 3/3] spapr: compute default value of "hpt-max-page-size" later Greg Kurz
2018-07-02  6:04   ` David Gibson

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=20180702060105.GA3422@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=clg@kaod.org \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).