All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	sam.bobroff@au1.ibm.com, rnsastry@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [RFC PATCH 1/2] spapr: Make h_register_process_table hcall flags global
Date: Thu, 11 May 2017 10:14:58 +1000	[thread overview]
Message-ID: <20170511001458.GC14408@umbus.fritz.box> (raw)
In-Reply-To: <1494234377-1773-2-git-send-email-bharata@linux.vnet.ibm.com>

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

On Mon, May 08, 2017 at 02:36:16PM +0530, Bharata B Rao wrote:
> The flags used in h_register_process_table hcall are needed in spapr.c
> and hence move them to a header file. While doing so, give them
> slightly specific names.
> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/ppc/spapr_hcall.c   | 31 ++++++++++++++-----------------
>  include/hw/ppc/spapr.h | 10 ++++++++++
>  2 files changed, 24 insertions(+), 17 deletions(-)
> 
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 0d608d6..3600b0e 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -924,13 +924,6 @@ static void spapr_check_setup_free_hpt(sPAPRMachineState *spapr,
>      return;
>  }
>  
> -#define FLAGS_MASK              0x01FULL
> -#define FLAG_MODIFY             0x10
> -#define FLAG_REGISTER           0x08
> -#define FLAG_RADIX              0x04
> -#define FLAG_HASH_PROC_TBL      0x02
> -#define FLAG_GTSE               0x01
> -
>  static target_ulong h_register_process_table(PowerPCCPU *cpu,
>                                               sPAPRMachineState *spapr,
>                                               target_ulong opcode,
> @@ -943,12 +936,13 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu,
>      target_ulong table_size = args[3];
>      uint64_t cproc;
>  
> -    if (flags & ~FLAGS_MASK) { /* Check no reserved bits are set */
> +    if (flags & ~SPAPR_PROC_TABLE_MASK) { /* Check no reserved bits are set */
>          return H_PARAMETER;
>      }
> -    if (flags & FLAG_MODIFY) {
> -        if (flags & FLAG_REGISTER) {
> -            if (flags & FLAG_RADIX) { /* Register new RADIX process table */
> +    if (flags & SPAPR_PROC_TABLE_MODIFY) {
> +        if (flags & SPAPR_PROC_TABLE_REGISTER) {
> +            if (flags & SPAPR_PROC_TABLE_RADIX) {
> +                /* Register new RADIX process table */
>                  if (proc_tbl & 0xfff || proc_tbl >> 60) {
>                      return H_P2;
>                  } else if (page_size) {
> @@ -958,7 +952,8 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu,
>                  }
>                  cproc = PATBE1_GR | proc_tbl | table_size;
>              } else { /* Register new HPT process table */
> -                if (flags & FLAG_HASH_PROC_TBL) { /* Hash with Segment Tables */
> +                if (flags & SPAPR_PROC_TABLE_HPT_PT) {
> +                    /* Hash with Segment Tables */
>                      /* TODO - Not Supported */
>                      /* Technically caused by flag bits => H_PARAMETER */
>                      return H_PARAMETER;
> @@ -981,7 +976,8 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu,
>              cproc = spapr->patb_entry & PATBE1_GR;
>          }
>      } else { /* Maintain current registration */
> -        if (!(flags & FLAG_RADIX) != !(spapr->patb_entry & PATBE1_GR)) {
> +        if (!(flags & SPAPR_PROC_TABLE_RADIX) !=
> +            !(spapr->patb_entry & PATBE1_GR)) {
>              /* Technically caused by flag bits => H_PARAMETER */
>              return H_PARAMETER; /* Existing Process Table Mismatch */
>          }
> @@ -996,13 +992,14 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu,
>      /* Update the UPRT and GTSE bits in the LPCR for all cpus */
>      CPU_FOREACH(cs) {
>          set_spr(cs, SPR_LPCR, LPCR_UPRT | LPCR_GTSE,
> -                ((flags & (FLAG_RADIX | FLAG_HASH_PROC_TBL)) ? LPCR_UPRT : 0) |
> -                ((flags & FLAG_GTSE) ? LPCR_GTSE : 0));
> +                ((flags & (SPAPR_PROC_TABLE_RADIX | SPAPR_PROC_TABLE_HPT_PT)) ?
> +                LPCR_UPRT : 0) | ((flags & SPAPR_PROC_TABLE_GTSE) ?
> +                SPAPR_PROC_TABLE_GTSE : 0));
>      }
>  
>      if (kvm_enabled()) {
> -        return kvmppc_configure_v3_mmu(cpu, flags & FLAG_RADIX,
> -                                       flags & FLAG_GTSE, cproc);
> +        return kvmppc_configure_v3_mmu(cpu, flags & SPAPR_PROC_TABLE_RADIX,
> +                                       flags & SPAPR_PROC_TABLE_GTSE, cproc);
>      }
>      return H_SUCCESS;
>  }
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 5802f88..a692e63 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -681,4 +681,14 @@ int spapr_rng_populate_dt(void *fdt);
>  
>  void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg);
>  
> +/*
> + * Defines for flag value used in H_REGISTER_PROC_TBL hcall.
> + */
> +#define SPAPR_PROC_TABLE_MASK        0x01FULL
> +#define SPAPR_PROC_TABLE_MODIFY      0x10
> +#define SPAPR_PROC_TABLE_REGISTER    0x08
> +#define SPAPR_PROC_TABLE_RADIX       0x04
> +#define SPAPR_PROC_TABLE_HPT_PT      0x02
> +#define SPAPR_PROC_TABLE_GTSE        0x01
> +
>  #endif /* HW_SPAPR_H */

-- 
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: 819 bytes --]

  reply	other threads:[~2017-05-11  1:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08  9:06 [Qemu-devel] [RFC PATCH 0/2] ppc/spapr: Fix migration of radix guests Bharata B Rao
2017-05-08  9:06 ` [Qemu-devel] [RFC PATCH 1/2] spapr: Make h_register_process_table hcall flags global Bharata B Rao
2017-05-11  0:14   ` David Gibson [this message]
2017-05-08  9:06 ` [Qemu-devel] [RFC PATCH 2/2] spapr: Fix migration of Radix guests Bharata B Rao
2017-05-11  1:02   ` David Gibson
2017-05-17  3:42     ` Bharata B Rao

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=20170511001458.GC14408@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rnsastry@linux.vnet.ibm.com \
    --cc=sam.bobroff@au1.ibm.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 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.