qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [PATCH v2 1/2] ppc/pnv: Add model for Power8 PHB3 PCIe Ho


From: Cédric Le Goater
Subject: Re: [Qemu-ppc] [PATCH v2 1/2] ppc/pnv: Add model for Power8 PHB3 PCIe Host bridge
Date: Mon, 23 Jul 2018 23:37:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 07/18/2018 08:12 AM, David Gibson wrote:
>> +static void pnv_phb3_get_phb_id(Object *obj, Visitor *v, const char *name,
>> +                              void *opaque, Error **errp)
>> +{
>> +    Property *prop = opaque;
>> +    uint32_t *ptr = qdev_get_prop_ptr(DEVICE(obj), prop);
>> +
>> +    visit_type_uint32(v, name, ptr, errp);
>> +}
>> +
>> +static void pnv_phb3_set_phb_id(Object *obj, Visitor *v, const char *name,
>> +                              void *opaque, Error **errp)
>> +{
>> +    PnvPHB3 *phb = PNV_PHB3(obj);
>> +    uint32_t phb_id;
>> +    Error *local_err = NULL;
>> +
>> +    visit_type_uint32(v, name, &phb_id, &local_err);
>> +    if (local_err) {
>> +        error_propagate(errp, local_err);
>> +        return;
>> +    }
>> +
>> +    /*
>> +     * Limit to a maximum of 6 PHBs per chip
>> +     */
>> +    if (phb_id >= PNV8_CHIP_PHB3_MAX) {
>> +        error_setg(errp, "invalid PHB index: '%d'", phb_id);
>> +        return;
>> +    }
>> +
>> +    phb->phb_id = phb_id;
>> +}
>> +
>> +static const PropertyInfo pnv_phb3_phb_id_propinfo = {
>> +    .name = "irq",
>> +    .get = pnv_phb3_get_phb_id,
>> +    .set = pnv_phb3_set_phb_id,
>> +};
> Can't you use a static DeviceProps style property for this, which is a
> bit simpler?

yes but we will need these ops for user creatable devices. This is where
we will check the chip id.

C. 






reply via email to

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