lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFCwf13sxrNmwF+txKHy-vNkNDgsHSgbh66h0aYxVZStGY8GEg@mail.gmail.com>
Date:   Sat, 1 Jun 2019 08:01:13 +0300
From:   Oded Gabbay <oded.gabbay@...il.com>
To:     Dalit Ben Zoor <dbenzoor@...ana.ai>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] habanalabs: restore unsecured registers default values

On Thu, May 30, 2019 at 11:46 AM Dalit Ben Zoor <dbenzoor@...ana.ai> wrote:
>
> unsecured registers can be changed by the user, and hence should be
> restored to their default values in context switch
>
> Signed-off-by: Dalit Ben Zoor <dbenzoor@...ana.ai>
> ---
>  drivers/misc/habanalabs/goya/goya.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
> index 87859c55b4b8..81c1d576783f 100644
> --- a/drivers/misc/habanalabs/goya/goya.c
> +++ b/drivers/misc/habanalabs/goya/goya.c
> @@ -786,7 +786,6 @@ static void goya_init_dma_ch(struct hl_device *hdev, int dma_id)
>         else
>                 sob_addr = CFG_BASE + mmSYNC_MNGR_SOB_OBJ_1007;
>
> -       WREG32(mmDMA_CH_0_WR_COMP_ADDR_LO + reg_off, lower_32_bits(sob_addr));
>         WREG32(mmDMA_CH_0_WR_COMP_ADDR_HI + reg_off, upper_32_bits(sob_addr));
>         WREG32(mmDMA_CH_0_WR_COMP_WDATA + reg_off, 0x80000001);
>  }
> @@ -4560,10 +4559,12 @@ static int goya_memset_device_memory(struct hl_device *hdev, u64 addr, u64 size,
>  int goya_context_switch(struct hl_device *hdev, u32 asid)
>  {
>         struct asic_fixed_properties *prop = &hdev->asic_prop;
> -       u64 addr = prop->sram_base_address;
> +       u64 addr = prop->sram_base_address, sob_addr;
>         u32 size = hdev->pldm ? 0x10000 : prop->sram_size;
>         u64 val = 0x7777777777777777ull;
> -       int rc;
> +       int rc, dma_id;
> +       u32 channel_off = mmDMA_CH_1_WR_COMP_ADDR_LO -
> +                                       mmDMA_CH_0_WR_COMP_ADDR_LO;
>
>         rc = goya_memset_device_memory(hdev, addr, size, val, false);
>         if (rc) {
> @@ -4571,7 +4572,19 @@ int goya_context_switch(struct hl_device *hdev, u32 asid)
>                 return rc;
>         }
>
> +       /* we need to reset registers that the user is allowed to change */
> +       sob_addr = CFG_BASE + mmSYNC_MNGR_SOB_OBJ_1007;
> +       WREG32(mmDMA_CH_0_WR_COMP_ADDR_LO, lower_32_bits(sob_addr));
> +
> +       for (dma_id = 1 ; dma_id < NUMBER_OF_EXT_HW_QUEUES ; dma_id++) {
> +               sob_addr = CFG_BASE + mmSYNC_MNGR_SOB_OBJ_1000 +
> +                                                       (dma_id - 1) * 4;
> +               WREG32(mmDMA_CH_0_WR_COMP_ADDR_LO + channel_off * dma_id,
> +                                               lower_32_bits(sob_addr));
> +       }
> +
>         WREG32(mmTPC_PLL_CLK_RLX_0, 0x200020);
> +
>         goya_mmu_prepare(hdev, asid);
>
>         goya_clear_sm_regs(hdev);
> --
> 2.17.1
>
The patch-set is:
Reviewed-by: Oded Gabbay <oded.gabbay@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ