From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9A5F5FB89 for ; Tue, 19 Mar 2024 21:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710885564; cv=none; b=FGb+qUbvCBZ5XpyCB7bQgf3MAWv/mv6WhLYXDqTO89XtquGbq8Xzss2LJdiEJgsINpBqyynpXmHR2sel0kqpZPtpK+seU/sy3LW32jga88cTgoY+Y0rin8dz7jDC8S1DFn3pDHOtow7xvvodrWPaf+shm3Js4uUqIN1MiFMMl38= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710885564; c=relaxed/simple; bh=cEPz5xiSAtfk2P9aOMl8XYGHlXI3VdaxfNONGT1LKvM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R3HvDAhCPUouDtZw37v7ILzdcOywqxrbBZwaHaEy7AajEMcNODuVYfK7So6Lyi4YDFEE2hh0GDBJ6LTfyuJnW8SKnJt/uZeYtX1nut42JmNzInBN5IMIRlC9Pa1ON506YbEYYXoR3lRZr9B1lHZCPCYDMpNTs72f7xLSBgx5wPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=HYuG4MNr; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="HYuG4MNr" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6e6f6d782e4so4000996b3a.0 for ; Tue, 19 Mar 2024 14:59:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1710885562; x=1711490362; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ciVO7+10eZV72+E/ORaPRZFjospVEi/8CuyB7rGS1wk=; b=HYuG4MNrlbRtf7eMgMVlSp7YIFl/zaBSEkSN2nLCpeGaa8injNEpimcOM/pmORtX5B wkOgt2UsyMS3WNLkmjcb/Gls9H9TD8/S0QowXNmoCv3eR6hlnmr8g2IiuB/IXFDaU7es 5mX/GEYb4GFWUw2LZbFjygdKRPnMyM32Mbxw6HutCpsebShXiv6ieP+MPHp0an8wp3Za 7abnvPp3zhMmR7yeuciUt0UB7a0/XFuecp8aXpaaIjKRkzIu98vfGEmvacKWmHXUroSj tm8YNa5jd+eTdpe30nTHV38k5NCtSxDfj7gn3OOmbTKKR+E+wbVtmoYJ/6jo45BKSD1N r0hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710885562; x=1711490362; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ciVO7+10eZV72+E/ORaPRZFjospVEi/8CuyB7rGS1wk=; b=RDPmUWu2/ooY7yz7cF+sH12T+kBEfxGsZo7KXKfc8F2BXtPS87NfDhBiXssM4tKTYD 1oYZK8iNUdrh/khNOia5dgmqZZFtdNsYjUYGkqOB4HQWeRN0b2T4MUyxF60pyiOj9UxJ hmmc3XciintaXInYO+8jZaFD53R51QRYdgCee8GAfwPhaP8LpnyqKuh9V/0ln4fq73o0 q7zo1Kd8Fd/OZmAWRDUAgK8sDc7ZY7CzOgBKt+/vtOedezAjmOqM2hfRor1CbvmbveG1 48b21823YSQhOGr4iRYyk1WFrUrfA8LfrFmIdoHfJnyGcP35Bs+0nFI4vmUoa4TC3F5M Z57g== X-Forwarded-Encrypted: i=1; AJvYcCX8UYVO0z4kMgfQRuLEE1N+5183p+ftwHCJnbD6N4CYEoIyG9GyuB2T3VjLGr4aWEGb5z9h1G5dr+lsswTc4ZxBcv8gQCI4IB4V/MsF X-Gm-Message-State: AOJu0YwhJJIQXflf7ASBQOuE3FikqO1pEI29ht3wdKILnlXNjxNIE6ls WW2ThxZy01HyyIHufIN2a/w3Znwd5l/JITOh+JRZ/T6DYS/sJfzr5d/5HTkOTPc= X-Google-Smtp-Source: AGHT+IFywIvk95HmWYC1ps8ZiAyORSpJBD5fZsHjoqcZoqHYlw5bVo0KamFA/Wgvuncr3jxrfpyfUQ== X-Received: by 2002:a05:6a00:721c:b0:6e6:fcd4:4f44 with SMTP id lk28-20020a056a00721c00b006e6fcd44f44mr11479878pfb.16.1710885561953; Tue, 19 Mar 2024 14:59:21 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id z25-20020aa785d9000000b006e6c61b264bsm10273892pfn.32.2024.03.19.14.59.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 14:59:21 -0700 (PDT) From: Samuel Holland To: Palmer Dabbelt , linux-riscv@lists.infradead.org Cc: devicetree@vger.kernel.org, Catalin Marinas , linux-kernel@vger.kernel.org, tech-j-ext@lists.risc-v.org, Conor Dooley , kasan-dev@googlegroups.com, Evgenii Stepanov , Krzysztof Kozlowski , Rob Herring , Samuel Holland , Albert Ou , Paul Walmsley Subject: [RFC PATCH 4/9] riscv: Define is_compat_thread() Date: Tue, 19 Mar 2024 14:58:30 -0700 Message-ID: <20240319215915.832127-5-samuel.holland@sifive.com> X-Mailer: git-send-email 2.43.1 In-Reply-To: <20240319215915.832127-1-samuel.holland@sifive.com> References: <20240319215915.832127-1-samuel.holland@sifive.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This allows checking if some thread other than current is 32-bit. Signed-off-by: Samuel Holland --- arch/riscv/include/asm/compat.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/riscv/include/asm/compat.h b/arch/riscv/include/asm/compat.h index 2ac955b51148..233c439c12d7 100644 --- a/arch/riscv/include/asm/compat.h +++ b/arch/riscv/include/asm/compat.h @@ -12,11 +12,18 @@ #include #include +#ifdef CONFIG_COMPAT + static inline int is_compat_task(void) { return test_thread_flag(TIF_32BIT); } +static inline int is_compat_thread(struct thread_info *thread) +{ + return test_ti_thread_flag(thread, TIF_32BIT); +} + struct compat_user_regs_struct { compat_ulong_t pc; compat_ulong_t ra; @@ -126,4 +133,13 @@ static inline void cregs_to_regs(struct compat_user_regs_struct *cregs, regs->t6 = (unsigned long) cregs->t6; }; +#else + +static inline int is_compat_thread(struct thread_info *thread) +{ + return 0; +} + +#endif + #endif /* __ASM_COMPAT_H */ -- 2.43.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA240C6FD1F for ; Tue, 19 Mar 2024 21:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CoX5bqjstk0sdAD5+6gSm+uGVxJS5mGu5tjYL5LyQEY=; b=iJ7stJfP16hLzc ruNmt6LJ7Y85qbCjF6uPVbXErgFDwENxvyDm53wMFINCbeEje2D2nfa6vBb6VFNvJ7axL5b7SJTjO hLlVnL+hUMDlb2qc5q82pa0+R/RfJ/OYmak4fDO0JEATz/gOeIAbySjG+POZ4bgdpN0rp6Qn6TGPD I2Z5EpuDmdz5/8CmrxtJXkcyyycWeUT3t4hgFQOyoOdnjf6O+gqSsklKWpwxv1gOLNXLsFRAM4vmV EjrjscF9PkdWYNCPzJceh3o73+SjRuAEHJ3V7W86Y5UNIBVXkY7J3C90gTInvH5sUAzgzd7Y8qjzq hhki/q23vI/hxGzFAYgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmhUa-0000000EMkE-3Hxy; Tue, 19 Mar 2024 21:59:32 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmhUT-0000000EMew-2Zyq for linux-riscv@lists.infradead.org; Tue, 19 Mar 2024 21:59:27 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6e6f6d782e4so4000995b3a.0 for ; Tue, 19 Mar 2024 14:59:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1710885562; x=1711490362; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ciVO7+10eZV72+E/ORaPRZFjospVEi/8CuyB7rGS1wk=; b=HFcEpbhTDIzPhffKUK2gFsLkt//X+eo5dTnQ1bDy7WkFpKXT4f6wLVbp1NTUcr+xd7 kW3Le5ViqEq0pMguzDqmm8plzHLxMZ4FLxeld85/ig8W2MznT/nJlDpKoOnr8mCuSVaB LU1//TGFLFIc0tYyRn9XATwS7oNlipH3APtLaRDSZF/5Mk5kZ7WsriX2g82m++sOvpXX Jk4902vHJI6Fu1eElUvGJp1Pl0L0n78LGCfZRT8moBXbcf8cKLyosgp0A413TSf/NMgz pr4c7f1B7UPb5RVUxRNinpbz0MkilZntqtveukzveOxM/T5ZrJNmE20Y5WyXwxSENjlX h+5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710885562; x=1711490362; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ciVO7+10eZV72+E/ORaPRZFjospVEi/8CuyB7rGS1wk=; b=NnHBy2q8rDXAM/7MZZIfrL067bPDdoNoNAySINMfbiaP2JCwh7g7YCW9U+DWRBIJxt qsB/uNzanzyTtDsSDg/PLUFjShz8SWr2PuJNK8+L6fGk5ToWvRB22PTfVsaHDJx0Vp/K 44+4t4BLjhf0gI4VL8u6jx/ZXvoCkdgA9STEVqrIUYRvVdkMaZBvvbAKGf+XSOdcQGt+ Fuh2V6/gYLyl+MEYphElDPghY88MaUy6rr9PM9YDL4xVJVCkgVIDKjUJtvg8LEaAca5j GiSFIfCC0GS9akU5mqPD2A5N5DYRSFAsZgy4KXODiUX1jvAh/nXjo3zZGXOdDSaWxBTT khzQ== X-Forwarded-Encrypted: i=1; AJvYcCUODhjsXOsyYufibSW/ciZy06n5+G9as5/WBIbiAAbOj3pAJXoc5SfBldIf2FK6v1CHWnOb7o3yuB0b7/DuWyq9YjkcGsPxtPqLOGe6bTuk X-Gm-Message-State: AOJu0YxKDnhfEBTM0djDFOZ5m//2x2c+Gt6Ek46TjhPVvU7TEN07nOzS 1QJ5ybhG45nYxezKVfUnexMz7U4GkL6lsWoS90rPhPUiD5/cu/L4Q5lTRYE2zm8= X-Google-Smtp-Source: AGHT+IFywIvk95HmWYC1ps8ZiAyORSpJBD5fZsHjoqcZoqHYlw5bVo0KamFA/Wgvuncr3jxrfpyfUQ== X-Received: by 2002:a05:6a00:721c:b0:6e6:fcd4:4f44 with SMTP id lk28-20020a056a00721c00b006e6fcd44f44mr11479878pfb.16.1710885561953; Tue, 19 Mar 2024 14:59:21 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id z25-20020aa785d9000000b006e6c61b264bsm10273892pfn.32.2024.03.19.14.59.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 14:59:21 -0700 (PDT) From: Samuel Holland To: Palmer Dabbelt , linux-riscv@lists.infradead.org Cc: devicetree@vger.kernel.org, Catalin Marinas , linux-kernel@vger.kernel.org, tech-j-ext@lists.risc-v.org, Conor Dooley , kasan-dev@googlegroups.com, Evgenii Stepanov , Krzysztof Kozlowski , Rob Herring , Samuel Holland , Albert Ou , Paul Walmsley Subject: [RFC PATCH 4/9] riscv: Define is_compat_thread() Date: Tue, 19 Mar 2024 14:58:30 -0700 Message-ID: <20240319215915.832127-5-samuel.holland@sifive.com> X-Mailer: git-send-email 2.43.1 In-Reply-To: <20240319215915.832127-1-samuel.holland@sifive.com> References: <20240319215915.832127-1-samuel.holland@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240319_145925_726838_88965E7D X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org This allows checking if some thread other than current is 32-bit. Signed-off-by: Samuel Holland --- arch/riscv/include/asm/compat.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/riscv/include/asm/compat.h b/arch/riscv/include/asm/compat.h index 2ac955b51148..233c439c12d7 100644 --- a/arch/riscv/include/asm/compat.h +++ b/arch/riscv/include/asm/compat.h @@ -12,11 +12,18 @@ #include #include +#ifdef CONFIG_COMPAT + static inline int is_compat_task(void) { return test_thread_flag(TIF_32BIT); } +static inline int is_compat_thread(struct thread_info *thread) +{ + return test_ti_thread_flag(thread, TIF_32BIT); +} + struct compat_user_regs_struct { compat_ulong_t pc; compat_ulong_t ra; @@ -126,4 +133,13 @@ static inline void cregs_to_regs(struct compat_user_regs_struct *cregs, regs->t6 = (unsigned long) cregs->t6; }; +#else + +static inline int is_compat_thread(struct thread_info *thread) +{ + return 0; +} + +#endif + #endif /* __ASM_COMPAT_H */ -- 2.43.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv