From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id CEEBF3858D39 for ; Sun, 27 Aug 2023 01:22:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CEEBF3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6bc9254a1baso1644515a34.2 for ; Sat, 26 Aug 2023 18:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693099322; x=1693704122; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=W3/K8t2Nv6YBD3svjjKsjzGz04jpg3KvhhWJo1AIEmU=; b=pY+YpWBMb0UDPQidj7XuaP5xWE8fFxMBoDtX2U3hvMQ2ak7fErxiFVIQRXNVWi4v/k XHhd881oYo+VvEqygl6GmcC9jZf3CX7OBW3KaEFwOGuJwwZ0T155O1s6dcjsyR8Kx1io yz8ZrNWUNxpCKaXPqCkcUQlQ3EoPYBujuKWJBf1g2EadmES4OI8khZAYEfmovRWwD4VP IG9o/IwLX4CADC5WHfln1Uz9RQXJoseMXqZFaMBXxBoQieAFHPsiVkgRK6ydcogvKNSB x91OjYM/0P/hjVw4ZiywyaoKtYb6dWB/48J8PKs/9d+EBh/yUFx/XgjJVj0dgD50gmWA fSxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693099322; x=1693704122; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=W3/K8t2Nv6YBD3svjjKsjzGz04jpg3KvhhWJo1AIEmU=; b=lMmIMAiQIRwtWt1Hr6MGRzSHKx37mza9qB298xt6RD5m2JIr7ySd+I1wGBP89M8fLQ 2HaupIq7GrcZK7hSpC+zi+2oh9+sCxlRP9K7MFjaw/SEgWmCJNuSjdWPdkIqd1El/cJe EmWouqG8QGZzKdTgyjf68vIRiOMUv8mc/umAG3U4/lVqQ+kXSIa2v5Jo71HtS/i+DCkp 8c39XEViziSwnwHjYCmmM9hwW/NHS3JM+5CjzrMzeNCguet1wpq4onKVuz2LXBsAeLEK 3ELAH7mo0K56meeNye5ZEPmdlOKxTvJ+wGnRNnPr4eazhhz0kxFWy5vho0tLpVc8wG8y NxhQ== X-Gm-Message-State: AOJu0YyCmZ+36GVs/oGnbifkykg2Xetx4+4CySjrULlWqTXinFJ9McZY o8ytWDJqqCnBhnj4LYSewC/sV0C/eIInFCPIxKw= X-Google-Smtp-Source: AGHT+IGckClr7AKwHx48T0HxSh/ipCqtoYACFFociqXXG/bs3ZpnD/iHymL7Y144YX2jzhQMxKOiwA== X-Received: by 2002:a05:6870:ac2c:b0:1be:deef:748a with SMTP id kw44-20020a056870ac2c00b001bedeef748amr8007912oab.50.1693099322007; Sat, 26 Aug 2023 18:22:02 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:32e5:4bbf:ada3:7bf7]) by smtp.gmail.com with ESMTPSA id ay3-20020a056820150300b0055ab0abaf31sm2301030oob.19.2023.08.26.18.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Aug 2023 18:22:01 -0700 (PDT) References: <20230822112144.1513268-1-luis.machado@arm.com> <20230822112144.1513268-5-luis.machado@arm.com> User-agent: mu4e 1.10.5; emacs 28.2 From: Thiago Jung Bauermann To: Luis Machado Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 4/6] [gdb/aarch64] sme2: Core file support for ZT register set In-reply-to: <20230822112144.1513268-5-luis.machado@arm.com> Date: Sat, 26 Aug 2023 22:21:59 -0300 Message-ID: <87bketl1oo.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Luis Machado writes: > This patch adds support for ZT register dumps/reads for core files. The > ZT register is available when the SME2 feature is advertised as available > by the Linux Kernel. > > Unlike the enablement for SME1 and the ZA register, support for SME2 is rather > simple given the fixed size of the ZT0 register. > > Validated on the Fast Models. > --- > gdb/aarch64-linux-tdep.c | 81 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 81 insertions(+) > > diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c > index 8b0b4d32971..a4d1fb87cbf 100644 > --- a/gdb/aarch64-linux-tdep.c > +++ b/gdb/aarch64-linux-tdep.c > @@ -1374,6 +1374,50 @@ aarch64_linux_collect_za_regset (const struct regset *regset, > size - SVE_HEADER_SIZE); > } > > +/* Supply register REGNUM from BUF to REGCACHE, using the register map > + in REGSET. If REGNUM is -1, do this for all registers in REGSET. > + If BUF is NULL, set the registers to "unavailable" status. */ > + > +static void > +aarch64_linux_supply_zt_regset (const struct regset *regset, > + struct regcache *regcache, > + int regnum, const void *buf, size_t size) > +{ > + /* Read the ZT register note from a core file into the register buffer. */ > + > + /* Handle an empty buffer. */ > + if (buf == nullptr) > + return regcache->supply_regset (regset, regnum, nullptr, size); > + > + aarch64_gdbarch_tdep *tdep > + = gdbarch_tdep (regcache->arch ()); Is it worth adding here a "gdb_assert (size >= AARCH64_SME2_ZT0_SIZE)"? > + > + /* Supply the ZT0 register contents. */ > + regcache->raw_supply (tdep->sme2_zt0_regnum, buf); > +} > + > +/* Collect register REGNUM from REGCACHE to BUF, using the register > + map in REGSET. If REGNUM is -1, do this for all registers in > + REGSET. */ > + > +static void > +aarch64_linux_collect_zt_regset (const struct regset *regset, > + const struct regcache *regcache, > + int regnum, void *buf, size_t size) > +{ > + /* Read the ZT register contents from the register buffer into the core > + file section. */ > + > + gdb_assert (buf != nullptr); Also here, is it worth adding a "gdb_assert (size >= AARCH64_SME2_ZT0_SIZE)"? > + > + aarch64_gdbarch_tdep *tdep > + = gdbarch_tdep (regcache->arch ()); > + > + /* Dump the register cache contents for the ZT register to the buffer. */ > + regcache->collect_regset (regset, tdep->sme2_zt0_regnum, buf, > + AARCH64_SME2_ZT0_SIZE); > +} > + Reviewed-by: Thiago Jung Bauermann -- Thiago