qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
To: Alexey Kardashevskiy <aik@au1.ibm.com>
Cc: benh@au1.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	paulus@samba.org
Subject: Re: [Qemu-devel] [PATCH 1/5] target-ppc: Extend rtas-blob
Date: Tue, 02 Sep 2014 10:55:41 +0530	[thread overview]
Message-ID: <540554D5.5050107@linux.vnet.ibm.com> (raw)
In-Reply-To: <540542FC.6020304@au1.ibm.com>



On Tuesday 02 September 2014 09:39 AM, Alexey Kardashevskiy wrote:
> On 09/01/2014 09:23 PM, Aravinda Prasad wrote:
>>
>>
>> On Monday 01 September 2014 01:16 PM, Alexey Kardashevskiy wrote:
>>> On 08/25/2014 11:45 PM, Aravinda Prasad wrote:
>>>> Extend rtas-blob to accommodate error log. Error log
>>>> structure is saved in rtas space upon a machine check
>>>> exception.
>>>>
>>>> Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
>>>> ---
>>>>  hw/ppc/spapr.c                  |   13 ++++++++++---
>>>>  hw/ppc/spapr_rtas.c             |    4 ++--
>>>>  include/hw/ppc/spapr.h          |    2 +-
>>>>  pc-bios/spapr-rtas/spapr-rtas.S |   12 ++++++++++++
>>>>  4 files changed, 25 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>>>> index d01978f..1120988 100644
>>>> --- a/hw/ppc/spapr.c
>>>> +++ b/hw/ppc/spapr.c
>>>> @@ -85,6 +85,12 @@
>>>>  
>>>>  #define HTAB_SIZE(spapr)        (1ULL << ((spapr)->htab_shift))
>>>>  
>>>> +/*
>>>> + * The rtas-entry-offset should match the value specified in
>>>> + * spapr-rtas.S
>>>> + */
>>>> +#define RTAS_ENTRY_OFFSET       0x1000
>>>> +
>>>>  typedef struct sPAPRMachineState sPAPRMachineState;
>>>>  
>>>>  #define TYPE_SPAPR_MACHINE      "spapr-machine"
>>>> @@ -670,7 +676,8 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)
>>>>  static void spapr_finalize_fdt(sPAPREnvironment *spapr,
>>>>                                 hwaddr fdt_addr,
>>>>                                 hwaddr rtas_addr,
>>>> -                               hwaddr rtas_size)
>>>> +                               hwaddr rtas_size,
>>>> +                               hwaddr rtas_entry)
>>>>  {
>>>>      int ret, i;
>>>>      size_t cb = 0;
>>>> @@ -705,7 +712,7 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
>>>>      }
>>>>  
>>>>      /* RTAS */
>>>> -    ret = spapr_rtas_device_tree_setup(fdt, rtas_addr, rtas_size);
>>>> +    ret = spapr_rtas_device_tree_setup(fdt, rtas_addr, rtas_size, rtas_entry);
>>>>      if (ret < 0) {
>>>>          fprintf(stderr, "Couldn't set up RTAS device tree properties\n");
>>>>      }
>>>> @@ -808,7 +815,7 @@ static void ppc_spapr_reset(void)
>>>>  
>>>>      /* Load the fdt */
>>>>      spapr_finalize_fdt(spapr, spapr->fdt_addr, spapr->rtas_addr,
>>>> -                       spapr->rtas_size);
>>>> +                       spapr->rtas_size, spapr->rtas_addr + RTAS_ENTRY_OFFSET);
>>>>  
>>>>      /* Set up the entry state */
>>>>      first_ppc_cpu = POWERPC_CPU(first_cpu);
>>>> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
>>>> index 9ba1ba6..02ddbf9 100644
>>>> --- a/hw/ppc/spapr_rtas.c
>>>> +++ b/hw/ppc/spapr_rtas.c
>>>> @@ -328,7 +328,7 @@ void spapr_rtas_register(int token, const char *name, spapr_rtas_fn fn)
>>>>  }
>>>>  
>>>>  int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
>>>> -                                 hwaddr rtas_size)
>>>> +                                 hwaddr rtas_size, hwaddr rtas_entry)
>>>>  {
>>>>      int ret;
>>>>      int i;
>>>> @@ -349,7 +349,7 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
>>>>      }
>>>>  
>>>>      ret = qemu_fdt_setprop_cell(fdt, "/rtas", "linux,rtas-entry",
>>>> -                                rtas_addr);
>>>> +                                rtas_entry);
>>>>      if (ret < 0) {
>>>>          fprintf(stderr, "Couldn't add linux,rtas-entry property: %s\n",
>>>>                  fdt_strerror(ret));
>>>> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
>>>> index bbba51a..dedfa67 100644
>>>> --- a/include/hw/ppc/spapr.h
>>>> +++ b/include/hw/ppc/spapr.h
>>>> @@ -436,7 +436,7 @@ target_ulong spapr_rtas_call(PowerPCCPU *cpu, sPAPREnvironment *spapr,
>>>>                               uint32_t token, uint32_t nargs, target_ulong args,
>>>>                               uint32_t nret, target_ulong rets);
>>>>  int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
>>>> -                                 hwaddr rtas_size);
>>>> +                                 hwaddr rtas_size, hwaddr rtas_entry);
>>>>  
>>>>  #define SPAPR_TCE_PAGE_SHIFT   12
>>>>  #define SPAPR_TCE_PAGE_SIZE    (1ULL << SPAPR_TCE_PAGE_SHIFT)
>>>> diff --git a/pc-bios/spapr-rtas/spapr-rtas.S b/pc-bios/spapr-rtas/spapr-rtas.S
>>>> index 903bec2..8c9b17e 100644
>>>> --- a/pc-bios/spapr-rtas/spapr-rtas.S
>>>> +++ b/pc-bios/spapr-rtas/spapr-rtas.S
>>>> @@ -30,6 +30,18 @@
>>>>  
>>>>  .globl	_start
>>>>  _start:
>>>> +	/*
>>>> +	 * Reserve space for error log in RTAS blob.
>>>> +	 *
>>>> +	 * Either we can reserve initial bytes for error log followed by
>>>> +	 * rtas-entry or space can be reserved after rtas-entry. I prefer
>>>> +	 * former, as we already have rtas-base and rtas-entry (currently
>>>> +	 * both pointing to rtas-base) defined in qemu and we can update
>>>> +	 * rtas-entry to point to an offset from rtas-base. This avoids
>>>> +	 * unnecessary definition of rtas-error-offset while keeping
>>>> +	 * rtas-entry redundant.
>>>> +	 */
>>>> +	. = 0x1000
>>>
>>>
>>> Why not this (and not changing spapr-rtas.S)?
>>>
>>> --- a/hw/ppc/spapr.c
>>> +++ b/hw/ppc/spapr.c
>>> @@ -875,7 +875,8 @@ static void ppc_spapr_reset(void)
>>>                         spapr->rtas_size);
>>>
>>>      /* Copy RTAS over */
>>> -    cpu_physical_memory_write(spapr->rtas_addr, spapr->rtas_blob,
>>> +    cpu_physical_memory_write(spapr->rtas_addr + RTAS_ENTRY_OFFSET,
>>> +                              spapr->rtas_blob,
>>>                                spapr->rtas_size);
>>
>> This is possible, however requires suitable adjustment to make sure
>> spapr->rtas_addr has enough space allocated.
> 
> 
> How is adding RTAS_ENTRY_OFFSET not enough to make sure that is has enough
> space? QEMU copies RTAS to guest memory, QEMU makes up rtas_addr/entry
> properties.

QEMU adds spapr-rtas.bin as a rom, with rom->addr set to
spapr->rtas_addr, rom->datasize set to 20 bytes (the size of current
spapr-rtas.bin) and contents of spapr-rtas.bin read into rom->data
(malloc-ed region).

I think, access to spapr->rtas_addr is mapped to this rom. Hence it is
necessary to have rtas_addr and rtas_size consistent with the Rom
struct. If we use spapr->rtas_addr + RTAS_ENTRY_OFFSET then we are
trying to access an invalid offset in rom region.


> 
> 
>>
>>>
>>>
>>>
>>>
>>>>  	mr	4,3
>>>>  	lis	3,KVMPPC_H_RTAS@h
>>>>  	ori	3,3,KVMPPC_H_RTAS@l
>>>>
>>>
>>>
>>
> 
> 

-- 
Regards,
Aravinda

  reply	other threads:[~2014-09-02  5:26 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25 13:45 [Qemu-devel] [PATCH 0/5] target-ppc: Add FWNMI support in QEMU for powerKVM guests Aravinda Prasad
2014-08-25 13:45 ` [Qemu-devel] [PATCH 1/5] target-ppc: Extend rtas-blob Aravinda Prasad
2014-08-26  5:38   ` David Gibson
2014-08-26  6:34     ` Aravinda Prasad
2014-08-26  7:24       ` David Gibson
2014-08-28 10:40   ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-08-28 18:20     ` Aravinda Prasad
2014-08-28 22:18       ` Alexander Graf
2014-08-28 22:25         ` Benjamin Herrenschmidt
2014-08-29  0:40           ` Alexander Graf
2014-08-29  1:06             ` Benjamin Herrenschmidt
2014-08-29  1:33               ` Alexander Graf
2014-08-29  2:42                 ` Benjamin Herrenschmidt
2014-08-29  3:46                 ` David Gibson
2014-08-29  3:47         ` David Gibson
2014-09-01  7:46   ` [Qemu-devel] " Alexey Kardashevskiy
2014-09-01 11:23     ` Aravinda Prasad
2014-09-02  4:09       ` Alexey Kardashevskiy
2014-09-02  5:25         ` Aravinda Prasad [this message]
2014-09-02  5:49           ` Alexey Kardashevskiy
2014-09-02  5:56             ` Aravinda Prasad
2014-09-02  6:34               ` Alexey Kardashevskiy
2014-09-02  7:07                 ` Aravinda Prasad
2014-09-02  8:40                   ` Alexey Kardashevskiy
2014-09-02  9:30                     ` Aravinda Prasad
2014-09-02 13:17                       ` Alexey Kardashevskiy
2014-08-25 13:45 ` [Qemu-devel] [PATCH 2/5] target-ppc: Register and handle HCALL to receive updated RTAS region Aravinda Prasad
2014-08-26  5:39   ` David Gibson
2014-08-26  6:15     ` Benjamin Herrenschmidt
2014-08-26  7:24       ` David Gibson
2014-08-26 20:05         ` Benjamin Herrenschmidt
2014-08-25 13:45 ` [Qemu-devel] [PATCH 3/5] target-ppc: Build error log Aravinda Prasad
2014-08-26  5:47   ` David Gibson
2014-08-26  6:40     ` Aravinda Prasad
2014-08-27  9:50   ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-08-28  6:12     ` Aravinda Prasad
2014-08-28  8:36       ` Alexander Graf
2014-08-28 10:21         ` Benjamin Herrenschmidt
2014-08-28 10:29           ` Alexander Graf
2014-08-28 10:33             ` Benjamin Herrenschmidt
2014-08-28 10:34               ` Benjamin Herrenschmidt
2014-08-28 17:17               ` Aravinda Prasad
2014-08-28 20:07                 ` Benjamin Herrenschmidt
2014-08-30  8:06                   ` Aravinda Prasad
2014-08-25 13:45 ` [Qemu-devel] [PATCH 4/5] target-ppc: Handle ibm, nmi-register RTAS call Aravinda Prasad
2014-08-26  6:02   ` David Gibson
2014-08-26  6:57     ` Aravinda Prasad
2014-08-27 10:37   ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-08-28  6:38     ` Aravinda Prasad
2014-08-28  8:37       ` Alexander Graf
2014-08-28 13:06         ` Tom Musta
2014-08-28 13:11           ` Alexander Graf
2014-08-28 17:42         ` Aravinda Prasad
2014-08-28 22:16           ` Alexander Graf
2014-08-30  8:08             ` Aravinda Prasad
2014-09-04  8:25             ` Aravinda Prasad
2014-09-04 13:09               ` Alexander Graf
2014-09-04 13:49                 ` Aravinda Prasad
2014-09-05  8:46                   ` Alexander Graf
2014-09-05  8:52                     ` Aravinda Prasad
2014-09-07 20:47   ` Alexander Graf
2014-09-26  3:58     ` Alexey Kardashevskiy
2014-10-06  6:32     ` Aravinda Prasad
2014-10-06  9:40       ` Alexander Graf
2014-10-06 11:01         ` Aravinda Prasad
2014-08-25 13:45 ` [Qemu-devel] [PATCH 5/5] target-ppc: Handle cases when multi-processors get machine-check Aravinda Prasad
2014-08-26  6:04   ` David Gibson
2014-08-26  7:04     ` Aravinda Prasad
2014-08-27 10:40   ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-08-28  6:56     ` Aravinda Prasad
2014-08-28  8:39       ` Alexander Graf
2014-08-28  8:42       ` Alexander Graf
2014-08-28 17:45         ` Aravinda Prasad

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=540554D5.5050107@linux.vnet.ibm.com \
    --to=aravinda@linux.vnet.ibm.com \
    --cc=aik@au1.ibm.com \
    --cc=benh@au1.ibm.com \
    --cc=paulus@samba.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).