[PATCH v5 04/10] gna: initialize MMU

Andy Shevchenko andy.shevchenko at gmail.com
Thu Oct 20 19:00:43 UTC 2022


On Thu, Oct 20, 2022 at 8:57 PM Maciej Kwapulinski
<maciej.kwapulinski at linux.intel.com> wrote:
>
> From: Tomasz Jankowski <tomasz1.jankowski at intel.com>
>
> Setup MMU in the driver with a new memory component.

...

> +#define GNA_FEATURES                                           \
> +       .max_hw_mem = 256 * 1024 * 1024,                        \

SZ_256M ?

> +               .num_pagetables = 64,                           \
> +               .num_page_entries = PAGE_SIZE / sizeof(u32),    \
> +               /* desc_info all in bytes */                    \
> +               .desc_info = {                                  \
> +               .rsvd_size = 256,                               \
> +               .cfg_size = 256,                                \
> +               .desc_size = 784,                               \
> +               .mmu_info = {                                   \
> +                       .vamax_size = 4,                        \
> +                       .rsvd_size = 12,                        \
> +                       .pd_size = 4 * 64,                      \
> +               },                                              \

> +       }

Broken indentation?

...

> +#define GNA_DEV_HWID_CNL       0x5A11
> +#define GNA_DEV_HWID_EHL       0x4511
> +#define GNA_DEV_HWID_GLK       0x3190
> +#define GNA_DEV_HWID_ICL       0x8A11
> +#define GNA_DEV_HWID_JSL       0x4E11
> +#define GNA_DEV_HWID_TGL       0x9A11
> +#define GNA_DEV_HWID_RKL       0x4C11
> +#define GNA_DEV_HWID_ADL       0x464F
> +#define GNA_DEV_HWID_RPL       0xA74F
> +#define GNA_DEV_HWID_MTL       0x7E4C

Keep them sorted?

...

> +       for (i = 0; i < mmu->num_pagetables; i++) {
> +               pagetable_dma = mmu->pagetables_dma[i];
> +               pgdirn[i] = pagetable_dma >> PAGE_SHIFT;

PFN_DOWN()

> +       }

...

> +       desc_size = round_up(gna_priv->info.desc_info.desc_size, PAGE_SIZE);

PFN_UP() ?

...

> +       mmu->pagetables = drmm_kmalloc_array(&gna_priv->drm, mmu->num_pagetables, sizeof(*mmu->pagetables), GFP_KERNEL);

> +

Redundant blank line.

> +       if (!mmu->pagetables)
> +               return -ENOMEM;

...

> +static const struct gna_dev_info cnl_dev_info = {
> +       .hwid = GNA_DEV_HWID_CNL,
> +       GNA_GEN1_FEATURES

Leave a comma at the end. Same for all similar declarations.

> +};

...

> +#define INTEL_GNA_DEVICE(hwid, info)                           \
> +       { PCI_VDEVICE(INTEL, hwid), (kernel_ulong_t)(info) }

Drop this and use PCI_DEVICE_DATA() instead.

-- 
With Best Regards,
Andy Shevchenko


More information about the dri-devel mailing list