# Add your code comments below. There is no need to trim or delete
# any existing content -- just insert your comments under the relevant
# lines of code. Lines starting with "> " are quoted diff context and
# lines starting with "| " are comments from other reviewers.
# The final email will be reformatted automatically to include only
# the sections that have your comments.
#
> This commit replaces the unimplemented part of GSDMA in K230. And connect the 
> interrupt to plic.
> 
> Signed-off-by: Tao Ding <[email protected]>
>
> diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig
> index de37c08cae..d28ac06043 100644
> --- a/hw/riscv/Kconfig
> +++ b/hw/riscv/Kconfig
> @@ -162,3 +162,4 @@ config K230
>      select SERIAL_MM
>      select UNIMP
>      select K230_WDT
> +    select K230_GSDMA
> diff --git a/hw/riscv/k230.c b/hw/riscv/k230.c
> index 656f28190c..c80bd65694 100644
> --- a/hw/riscv/k230.c
> +++ b/hw/riscv/k230.c
> @@ -110,6 +110,7 @@ static void k230_soc_init(Object *obj)
>      object_initialize_child(obj, "c908-cpu", cpu0, TYPE_RISCV_HART_ARRAY);
>      object_initialize_child(obj, "k230-wdt0", &s->wdt[0], TYPE_K230_WDT);
>      object_initialize_child(obj, "k230-wdt1", &s->wdt[1], TYPE_K230_WDT);
> +    object_initialize_child(obj, "k230-gsdma", &s->gsdma, TYPE_K230_GSDMA);
>  
>      qdev_prop_set_uint32(DEVICE(cpu0), "hartid-base", 0);
>      qdev_prop_set_string(DEVICE(cpu0), "cpu-type", 
> TYPE_RISCV_CPU_THEAD_C908);
> @@ -206,6 +207,14 @@ static void k230_soc_realize(DeviceState *dev, Error 
> **errp)
>      sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[1]), 0,
>                         qdev_get_gpio_in(DEVICE(s->c908_plic), 
> K230_WDT1_IRQ));
>  
> +    /* Gsdma */
> +    if (!sysbus_realize(SYS_BUS_DEVICE(&s->gsdma), errp)) {
> +        return;
> +    }
> +    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gsdma), 0, 
> memmap[K230_DEV_GSDMA].base);
> +    sysbus_connect_irq(SYS_BUS_DEVICE(&s->gsdma), 0,
> +                       qdev_get_gpio_in(DEVICE(s->c908_plic), 
> K230_GSDMA_IRQ));
> +
>      /* unimplemented devices */
>      create_unimplemented_device("kpu.l2-cache",
>                                  memmap[K230_DEV_KPU_L2_CACHE].base,
> @@ -221,9 +230,6 @@ static void k230_soc_realize(DeviceState *dev, Error 
> **errp)
>                                  memmap[K230_DEV_AI_2D_ENGINE].base,
>                                  memmap[K230_DEV_AI_2D_ENGINE].size);
>  
> -    create_unimplemented_device("gsdma", memmap[K230_DEV_GSDMA].base,
> -                                memmap[K230_DEV_GSDMA].size);
> -
>      create_unimplemented_device("dma", memmap[K230_DEV_DMA].base,
>                                  memmap[K230_DEV_DMA].size);
>  
> diff --git a/include/hw/riscv/k230.h b/include/hw/riscv/k230.h
> index 592e1c26bf..156a386edc 100644
> --- a/include/hw/riscv/k230.h
> +++ b/include/hw/riscv/k230.h
> @@ -18,6 +18,7 @@
>  #include "hw/core/boards.h"
>  #include "hw/riscv/riscv_hart.h"
>  #include "hw/watchdog/k230_wdt.h"
> +#include "hw/dma/k230_gsdma.h"
>  
>  #define C908_CPU_HARTID   (0)
>  
> @@ -33,6 +34,7 @@ typedef struct K230SoCState {
>      RISCVHartArrayState c908_cpu; /* Small core */
>  
>      K230WdtState wdt[2];
> +    K230GSDMAState gsdma;
>      MemoryRegion sram;
>      MemoryRegion bootrom;
>  
> @@ -129,6 +131,7 @@ enum {
>      K230_UART4_IRQ  = 20,
>      K230_WDT0_IRQ   = 107,
>      K230_WDT1_IRQ   = 108,
> +    K230_GSDMA_IRQ  = 140,
>  };
>  
>  #define K230_UART_COUNT 5

Reviewed-by: Junze Cao <[email protected]>

-- 
Junze Cao <[email protected]>


Reply via email to