qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 01/12] spapr: populate DRC entries for root dt n


From: Bharata B Rao
Subject: Re: [Qemu-devel] [PATCH 01/12] spapr: populate DRC entries for root dt node
Date: Wed, 3 Sep 2014 11:25:52 +0530

On Tue, Aug 19, 2014 at 5:51 AM, Michael Roth <address@hidden> wrote:
> From: Nathan Fontenot <address@hidden>
>
> This add entries to the root OF node to advertise our PHBs as being
> DR-capable in according with PAPR specification.
>
> Each PHB is given a name of PHB<bus#>, advertised as a PHB type,
> and associated with a power domain of -1 (indicating to guests that
> power management is handled automatically by hardware).
>
> We currently allocate entries for up to 32 DR-capable PHBs, though
> this limit can be increased later.
>
> DrcEntry objects to track the state of the DR-connector associated
> with each PHB are stored in a 32-entry array, and each DrcEntry has
> in turn have a dynamically-sized number of child DR-connectors,
> which we will use later to track the state of DR-connectors
> associated with a PHB's physical slots.
>
> Signed-off-by: Nathan Fontenot <address@hidden>
> Signed-off-by: Michael Roth <address@hidden>
> ---
>  hw/ppc/spapr.c         | 143 
> +++++++++++++++++++++++++++++++++++++++++++++++++
>  hw/ppc/spapr_pci.c     |   1 +
>  include/hw/ppc/spapr.h |  35 ++++++++++++
>  3 files changed, 179 insertions(+)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 5c92707..d5e46c3 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -296,6 +296,143 @@ static hwaddr spapr_node0_size(void)
>      return ram_size;
>  }
>
> +sPAPRDrcEntry *spapr_phb_to_drc_entry(uint64_t buid)
> +{
> +    int i;
> +
> +    for (i = 0; i < SPAPR_DRC_TABLE_SIZE; i++) {
> +        if (spapr->drc_table[i].phb_buid == buid) {
> +            return &spapr->drc_table[i];
> +        }
> +     }
> +
> +     return NULL;
> +}
> +
> +static void spapr_init_drc_table(void)
> +{
> +    int i;
> +
> +    memset(spapr->drc_table, 0, sizeof(spapr->drc_table));
> +
> +    /* For now we only care about PHB entries */
> +    for (i = 0; i < SPAPR_DRC_TABLE_SIZE; i++) {
> +        spapr->drc_table[i].drc_index = 0x2000001 + i;
> +    }
> +}
> +
> +sPAPRDrcEntry *spapr_add_phb_to_drc_table(uint64_t buid, uint32_t state)
> +{
> +    sPAPRDrcEntry *empty_drc = NULL;
> +    sPAPRDrcEntry *found_drc = NULL;
> +    int i, phb_index;
> +
> +    for (i = 0; i < SPAPR_DRC_TABLE_SIZE; i++) {
> +        if (spapr->drc_table[i].phb_buid == 0) {
> +            empty_drc = &spapr->drc_table[i];
> +        }
> +
> +        if (spapr->drc_table[i].phb_buid == buid) {
> +            found_drc = &spapr->drc_table[i];
> +            break;
> +        }
> +    }
> +
> +    if (found_drc) {
> +        return found_drc;
> +    }
> +
> +    if (empty_drc) {
> +        empty_drc->phb_buid = buid;
> +        empty_drc->state = state;

Shouldn't this be

empty_drc->state = state << INDICATOR_ENTITY_SENSE_SHIFT ?

Regards,
Bharata.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]