From patchwork Wed Mar 15 03:03:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 13175248 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 E8A27C7618D for ; Wed, 15 Mar 2023 03:06: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:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tURnT4b0OfdQd0uXO4oRRVf7HkhK3dUXQ9dKW50mGh0=; b=nQ1Vl1eoRi9RrG wYMNPkLTl46axgOVtgIHyHh6rNmuQujPAw7HsPI+aOJjT6qhYe3wf6a6fT0VTXJXS10nr9Kzkv1PA hrNVbkraIQEsiPkLDlNJ+Wrl1HdIazTzJM4kY3f8WZI0i25ZiycB6sgKe2lpN4zSKOABhHlIRGGRv NIfmZDHjVAskrdfjMSLj1KGb/FibJXFKwj2NZuRIc/9Ia3i/q1cqAtLNira8kl6AkE2xvFZcKSodC Djf5n9RZ9HmPY1ie8TreyzEIDPtg8E7lOjViRGcaIXxx5aev696LxrSMKdlYHb4UWXsBfYgSSWwjk 7L5jhZJiWcvYSYqLlabQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcHST-00C6o0-1Q; Wed, 15 Mar 2023 03:05:45 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcHSE-00C6h2-1f for linux-arm-kernel@lists.infradead.org; Wed, 15 Mar 2023 03:05:33 +0000 Received: by mail-pj1-x102b.google.com with SMTP id f6-20020a17090ac28600b0023b9bf9eb63so458900pjt.5 for ; Tue, 14 Mar 2023 20:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1678849526; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=hPLiCKdxpc2r5PKNkHmqRCNmdb24wQijBhgYpLkC43U=; b=hZOWobSL1PKWIUT7UWS9tniLiB9mdfLQVx/Z/9zPgZaqvjnOteqzCtEB9HjY6uDm5Z iih9EdmkZVUeQo0xOfl1VcnfVacdcLCd8AJJAPxhyA2sm6Xke46e1e2rJ7Rh0BSVXkF8 LPvQJyzonpQFWDXt2SUjjq9ID4+tvuPP8BALY8prYRlpppPYUlsITVn79fdnaiUXQEF1 deb+t9btxFOPW+9acEXIhNbZp2doaKT5YgC3FtBNm79vfC3LW+6mWJ6+9PBqPIyH0Kic Coc17KHtjWazt5MqaHhgFOTwgQhPQ0N0ANZIoSAUsfoul0ONsbg8PSj+Y8JcyFTwqcEL HRCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678849526; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hPLiCKdxpc2r5PKNkHmqRCNmdb24wQijBhgYpLkC43U=; b=HjCapL2O1DdxonGIo8R0vUkxeJssffNffMG4vJPFzOcieXYJOXJS6q3rsb8U/v2W5C jdUAwxs3cyBtZ9Njjj9mzGV3AorZhjNA36232xMOmh+MOkC01182SZzLZP9SDYqGyyte 4cglOxlud6Xdm89dfei9sbhAGw1NnlZ/sO/1L2GX1692TvHvvqRHMA2eA/oyFUBcu4ES tJ8RSIFebrnzGJYaAl9wZlgQ0gIc/we4K5381E/B+gueNN5HvoNgquVnI9na2uBoO8GL sDx9ZCSJV0P1l4lBx4OhzLi+schrDEXBOcwzdTWxsrayFC/LwEB/7NcVEtt2anBL7Wqj EQPQ== X-Gm-Message-State: AO0yUKW5YhfS+E5S5nD27cuE2H8NzxkWYK5qj8DoU/j+MJigggOojsVB kCmgq218J64pqc7AuADchYzGOw== X-Google-Smtp-Source: AK7set9vypcudDyWo/h8khv9E95mQjVI9aZbPGtfY3t0wFWv20PLrTeh2GiFiqI+9gk8Y0mpUagQ+Q== X-Received: by 2002:a17:902:ec8a:b0:19e:416e:abf5 with SMTP id x10-20020a170902ec8a00b0019e416eabf5mr1078987plg.34.1678849526457; Tue, 14 Mar 2023 20:05:26 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id s30-20020a63451e000000b0050300a7c8c2sm2194674pga.89.2023.03.14.20.05.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 20:05:26 -0700 (PDT) Subject: [PATCH v2 1/6] riscv/mm/fault: simplify code for do_page_fault() Date: Tue, 14 Mar 2023 20:03:54 -0700 Message-Id: <20230315030359.14162-2-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315030359.14162-1-palmer@rivosinc.com> References: <20230315030359.14162-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tong Tiangen , Palmer Dabbelt From: Palmer Dabbelt To: akpm@linux-foundation.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230314_200530_563092_8A09912E X-CRM114-Status: GOOD ( 20.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Tong Tiangen To make the code more hierarchical and readable, we fold vma related judgments into __do_page_fault(). And to simplify the code, move the tsk->thread.bad_cause's setting into bad_area(). No functional change intended. Signed-off-by: Tong Tiangen Signed-off-by: Palmer Dabbelt --- arch/riscv/mm/fault.c | 77 +++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index 460f785f6e09..0a8c9afeee22 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -85,6 +85,8 @@ static inline void mm_fault_error(struct pt_regs *regs, unsigned long addr, vm_f static inline void bad_area(struct pt_regs *regs, struct mm_struct *mm, int code, unsigned long addr) { + current->thread.bad_cause = regs->cause; + /* * Something tried to access memory that isn't in our memory map. * Fix it, but check if it's kernel or user first. @@ -200,6 +202,38 @@ static inline bool access_error(unsigned long cause, struct vm_area_struct *vma) return false; } +#define VM_FAULT_BADMAP ((__force vm_fault_t)0x010000) +#define VM_FAULT_BADACCESS ((__force vm_fault_t)0x020000) + +static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr, + unsigned int mm_flags, struct pt_regs *regs) +{ + struct vm_area_struct *vma = find_vma(mm, addr); + + if (unlikely(!vma)) + return VM_FAULT_BADMAP; + + if (unlikely(vma->vm_start > addr)) { + if (unlikely(!(vma->vm_flags & VM_GROWSDOWN) || + expand_stack(vma, addr))) + return VM_FAULT_BADMAP; + } + + /* + * Ok, we have a good vm_area for this memory access, so + * we can handle it. + */ + if (unlikely(access_error(regs->cause, vma))) + return VM_FAULT_BADACCESS; + + /* + * If for any reason at all we could not handle the fault, + * make sure we exit gracefully rather than endlessly redo + * the fault. + */ + return handle_mm_fault(vma, addr, mm_flags, regs); +} + /* * This routine handles page faults. It determines the address and the * problem, and then passes it off to one of the appropriate routines. @@ -207,7 +241,6 @@ static inline bool access_error(unsigned long cause, struct vm_area_struct *vma) asmlinkage void do_page_fault(struct pt_regs *regs) { struct task_struct *tsk; - struct vm_area_struct *vma; struct mm_struct *mm; unsigned long addr, cause; unsigned int flags = FAULT_FLAG_DEFAULT; @@ -282,44 +315,16 @@ asmlinkage void do_page_fault(struct pt_regs *regs) flags |= FAULT_FLAG_INSTRUCTION; retry: mmap_read_lock(mm); - vma = find_vma(mm, addr); - if (unlikely(!vma)) { - tsk->thread.bad_cause = cause; - bad_area(regs, mm, code, addr); - return; - } - if (likely(vma->vm_start <= addr)) - goto good_area; - if (unlikely(!(vma->vm_flags & VM_GROWSDOWN))) { - tsk->thread.bad_cause = cause; - bad_area(regs, mm, code, addr); - return; - } - if (unlikely(expand_stack(vma, addr))) { - tsk->thread.bad_cause = cause; - bad_area(regs, mm, code, addr); - return; - } - /* - * Ok, we have a good vm_area for this memory access, so - * we can handle it. - */ -good_area: - code = SEGV_ACCERR; + fault = __do_page_fault(mm, addr, flags, regs); - if (unlikely(access_error(cause, vma))) { - tsk->thread.bad_cause = cause; - bad_area(regs, mm, code, addr); - return; - } + if (unlikely(fault & VM_FAULT_BADMAP)) + return bad_area(regs, mm, code, addr); - /* - * If for any reason at all we could not handle the fault, - * make sure we exit gracefully rather than endlessly redo - * the fault. - */ - fault = handle_mm_fault(vma, addr, flags, regs); + if (unlikely(fault & VM_FAULT_BADACCESS)) { + code = SEGV_ACCERR; + return bad_area(regs, mm, code, addr); + } /* * If we need to retry but a fatal signal is pending, handle the From patchwork Wed Mar 15 03:03:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 13175250 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 E0546C7618A for ; Wed, 15 Mar 2023 03:06:38 +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:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2aII4B24tjJxFBAm3Cd/wfpNfj7Hzb/HodWn3yjoVcM=; b=epkf03Yl3qtD/K HsNuzd+l3SwDDooeY76Si9GiS3h+bTed8gpTpbA0Ps97Q5NCP8+bG0/S2O3FzVCvYbtj6IZQyczTM LyrBWuLjmYJ5wyuM8VJF5WBm0ER6AFqOxr7+ZhDqMv1hEq7hVqyL6Ua0tncljngsHEkP1x1XEoap1 6lL8PTgpQSgkt8W96uKf/AWjjrJOBYz5XQKzhmiSoQAGxRFSWR3QCAkyFLMsWRKh6OYK/oPJE74iJ 46/KVIchg1nbJBlEenP2JvLHp/7eeesvHxea5kGSPK8ZFp9tMD/DGAZWreon63i+GkEhSSYD6sjx7 tktkLy/jvBvHGYgaL1Dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcHSM-00C6mZ-2h; Wed, 15 Mar 2023 03:05:38 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcHSE-00C6h5-2t for linux-arm-kernel@lists.infradead.org; Wed, 15 Mar 2023 03:05:33 +0000 Received: by mail-pj1-x1034.google.com with SMTP id h11-20020a17090a2ecb00b00237c740335cso464596pjs.3 for ; Tue, 14 Mar 2023 20:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1678849527; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=nnoQUwQmFqPgSrJHWK8d2p9DXhKQ1/cuEoil7CNd3DE=; b=TBNUeSBfuBa3ST4mxm1DS4OFwR6VEct391KodjBQ5eDMwvy7IAnH77PwGo1apR6bPh K7nIjhi/uZYJG5kt+DE6phOd9LZqfl9BFT5eMievU9L2UTVHzq36Jl6MFMdA5ssdKwUN gDJDd53OvmzgZShoscboUxRy+5c9II5aP7YLMLZ2PLDTbZH0uvz7j7szJopkCepK9dLm cA4Pv0tR7bnX1Y0V928WrhCq3OiYKHIIoWOc6+RX1qFGNwbibAeVMdjD8hiDrKwkQ60x sSkJH1wnncA5VLaZOh78cNkPD05vCaLhXPKstDORhMzPYnnwWiQ2oq7R2RYY4UnVQdNk 6WZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678849527; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nnoQUwQmFqPgSrJHWK8d2p9DXhKQ1/cuEoil7CNd3DE=; b=N/F06ahdQfjOf3Tzp9gUpKvz6qcTmBR8nWK9dkSv8vMonxWZA9f1vbb9WsXkB/DsZH poyQVDfPoVvrVK7CrApkJVhsPpVD8b48n0PiO0zvHpogeTDlS2WEoNm1+RQujAkzyaBx qDihJyamHw8QC9m6TtPjEmojDEqoBY9aak8Y8Fn30MG9GYlH6dtm95VDp7whE8PAU8RR 3Cd+wCB5K7q7sMM1a4c+P+yb6rvdvkWoYOay2GhBudY6YmOhJR0D+ibuXhBtprHFh9X3 VnXzUEutq/zaS7mpPOKzbB/uIJSv+L/HHZ3SsDeuy+XnkxauoXlfyl6xGr8g1keyiX56 ntug== X-Gm-Message-State: AO0yUKXtLJsCvp/n1UVU8C4iLMVNv3QdvXPTgSBAXqTRrpWfTqAC2SoG dFC6iLxY36CYo2jmrlci79rkzw== X-Google-Smtp-Source: AK7set9+C9cPA06JcNB4chJKZnGHWdotuV162jlrieE+Q24dYD3lVPW20yRGsbK4VhdL3hYON+iG1Q== X-Received: by 2002:a05:6a21:338c:b0:d5:4dc:16ce with SMTP id yy12-20020a056a21338c00b000d504dc16cemr7106582pzb.4.1678849527626; Tue, 14 Mar 2023 20:05:27 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id z20-20020aa785d4000000b005e093020cabsm2305210pfn.45.2023.03.14.20.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 20:05:27 -0700 (PDT) Subject: [PATCH v2 2/6] mm: Add a leading 0 to the VM_FAULT_* types Date: Tue, 14 Mar 2023 20:03:55 -0700 Message-Id: <20230315030359.14162-3-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315030359.14162-1-palmer@rivosinc.com> References: <20230315030359.14162-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Palmer Dabbelt From: Palmer Dabbelt To: akpm@linux-foundation.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230314_200530_933542_31662664 X-CRM114-Status: GOOD ( 11.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The next patch will add enough codes to need another character, this adds the 0 to all the existing codes to keep alignment. Signed-off-by: Palmer Dabbelt --- include/linux/mm_types.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 0722859c3647..fd9b863869b4 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -941,20 +941,20 @@ typedef __bitwise unsigned int vm_fault_t; * */ enum vm_fault_reason { - VM_FAULT_OOM = (__force vm_fault_t)0x000001, - VM_FAULT_SIGBUS = (__force vm_fault_t)0x000002, - VM_FAULT_MAJOR = (__force vm_fault_t)0x000004, - VM_FAULT_HWPOISON = (__force vm_fault_t)0x000010, - VM_FAULT_HWPOISON_LARGE = (__force vm_fault_t)0x000020, - VM_FAULT_SIGSEGV = (__force vm_fault_t)0x000040, - VM_FAULT_NOPAGE = (__force vm_fault_t)0x000100, - VM_FAULT_LOCKED = (__force vm_fault_t)0x000200, - VM_FAULT_RETRY = (__force vm_fault_t)0x000400, - VM_FAULT_FALLBACK = (__force vm_fault_t)0x000800, - VM_FAULT_DONE_COW = (__force vm_fault_t)0x001000, - VM_FAULT_NEEDDSYNC = (__force vm_fault_t)0x002000, - VM_FAULT_COMPLETED = (__force vm_fault_t)0x004000, - VM_FAULT_HINDEX_MASK = (__force vm_fault_t)0x0f0000, + VM_FAULT_OOM = (__force vm_fault_t)0x0000001, + VM_FAULT_SIGBUS = (__force vm_fault_t)0x0000002, + VM_FAULT_MAJOR = (__force vm_fault_t)0x0000004, + VM_FAULT_HWPOISON = (__force vm_fault_t)0x0000010, + VM_FAULT_HWPOISON_LARGE = (__force vm_fault_t)0x0000020, + VM_FAULT_SIGSEGV = (__force vm_fault_t)0x0000040, + VM_FAULT_NOPAGE = (__force vm_fault_t)0x0000100, + VM_FAULT_LOCKED = (__force vm_fault_t)0x0000200, + VM_FAULT_RETRY = (__force vm_fault_t)0x0000400, + VM_FAULT_FALLBACK = (__force vm_fault_t)0x0000800, + VM_FAULT_DONE_COW = (__force vm_fault_t)0x0001000, + VM_FAULT_NEEDDSYNC = (__force vm_fault_t)0x0002000, + VM_FAULT_COMPLETED = (__force vm_fault_t)0x0004000, + VM_FAULT_HINDEX_MASK = (__force vm_fault_t)0x00f0000, }; /* Encode hstate index for a hwpoisoned large page */ From patchwork Wed Mar 15 03:03:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 13175246 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 0E0F4C6FD1F for ; Wed, 15 Mar 2023 03:06:38 +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:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xpjMQEFGcHtFDzlYX24Ki1PpIRg4hNdB5GDJtmvhQaw=; b=U1RikVL/6wjr/I r3rcoMV4B0dDQP+6yOdV1UAOWT/mBVtVD/GqNkBn2gi9VjhFYOOI5ZFf0+tsUyTB1iV7id41p2++V lAKcsZddO77MYwwbnvjoudW1NEZU+LiXY3fMd5J3k2KpZoNHHojmG9Lg2MpBqrmFF8eJ41Pdmq7rh n1chQdIUc9n3U7JD+mcYhcjHEzBpcOf266Fo3NLsQyk7Y4gvywBx997y32AxgP4ukLupt7hLqU638 Mw+CwjUulcXrCvpFU6wkSNm1lXu21cbD4NJc3fLLnjmqOFQPStkXiLWNx1O/Yx36FB1ipDAf49cHL yhke9Jl8quFpjWflJGOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcHSU-00C6oM-25; Wed, 15 Mar 2023 03:05:46 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcHSF-00C6hB-25 for linux-arm-kernel@lists.infradead.org; Wed, 15 Mar 2023 03:05:34 +0000 Received: by mail-pl1-x62f.google.com with SMTP id p20so18607632plw.13 for ; Tue, 14 Mar 2023 20:05:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1678849529; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=kjXs6Q9el+E3DjFj75yzzOPO7Ucq3PFGsjms6Llyx9A=; b=mRz3PKHV4IBxR+2dOFKG5hwZul2ABonaRfC7Ehdx0OfdaJc8X1QKmjbUc3A/sMtQmb gbdDUmN6C0xqiSSvVk7V6RYl7rj70SnASOVED2xToUNivvfAXHpYOvdfNg9PNLDBWyDp IncEoQPsAhVH27iWxXjZiY9+MPHJp6iXyumIDVQgIFvnpqQ2awg+ak4Y4xvxSFjC0zod 3dJQKPZ3iUEBFf1zv/1bEdn3ErqHsi/M0WCTCcYx6qxBUNzn+biRBb8C3pLH8Kmj08p4 BzamwZHJuVc6k1iXhWSR7eCcnQcS6MM7x9tkiaPkVq0c4rPipsvwrOOR87W+SmOuO7ef mW4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678849529; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kjXs6Q9el+E3DjFj75yzzOPO7Ucq3PFGsjms6Llyx9A=; b=lOczSPRbplVLKCADuJlOwriRMXVUhhTZgRyoXBF9DoQEqDMXI73Y3b7Ecosqxmvosd dJbLsUFY+P0T0/DxejoWNUE5jbaDaA4VxK39NCxDAxm4/NmIBq2lK3bKoKJRMdBrWvkX XuXecpsJLmAppcufeio+ITJAoig2cAld68a5YeVglH1KeuPFqSs6+AN5ncjivuOsgFcL ZaKy0y3gYMNqenATMyK6GVhNDI7Yu+8iVceIxc8kBBBnRVjU8cfygkDSYcUCwHsIi2RM NAVsNPbLu9DCVAyAwKWIHx4qslqIEh8llhrh1Klrky1gk3HmUbPIzrjvNfFqJwMBniDf gXQw== X-Gm-Message-State: AO0yUKUR+E4bGllJtqbm9QfDMhOoL2Z2QsO8Fvg+iI5JgpF7Ydqe/jn4 jgkUoYJ1li1785Z1xuXo+bWpWg== X-Google-Smtp-Source: AK7set8aNlVZNOCixnv/wCzZZa//jnHG6FrTV/mi2NGNpxsUbRVCAmKzBlXv1PxwH+TLgm6P1rGJNQ== X-Received: by 2002:a17:903:48d:b0:19e:e39b:6d98 with SMTP id jj13-20020a170903048d00b0019ee39b6d98mr981507plb.35.1678849528720; Tue, 14 Mar 2023 20:05:28 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id jz12-20020a170903430c00b0019f2cee9221sm2447268plb.95.2023.03.14.20.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 20:05:28 -0700 (PDT) Subject: [PATCH v2 3/6] mm: Add VM_FAULT_ARCH_* codes Date: Tue, 14 Mar 2023 20:03:56 -0700 Message-Id: <20230315030359.14162-4-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315030359.14162-1-palmer@rivosinc.com> References: <20230315030359.14162-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Palmer Dabbelt From: Palmer Dabbelt To: akpm@linux-foundation.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230314_200531_763800_71A97CEF X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A handful of architectures (arm, s390, and soon RISC-V) define their own internal fault codes, so instead dedicate a few standard codes as being architecture-specific to avoid conflicts. Signed-off-by: Palmer Dabbelt --- include/linux/mm_types.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index fd9b863869b4..47f36a2fdaac 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -938,6 +938,7 @@ typedef __bitwise unsigned int vm_fault_t; * in DAX) * @VM_FAULT_COMPLETED: ->fault completed, meanwhile mmap lock released * @VM_FAULT_HINDEX_MASK: mask HINDEX value + * @VM_FAULT_ARCH_* Architecture-specific VM fault codes. * */ enum vm_fault_reason { @@ -955,6 +956,11 @@ enum vm_fault_reason { VM_FAULT_NEEDDSYNC = (__force vm_fault_t)0x0002000, VM_FAULT_COMPLETED = (__force vm_fault_t)0x0004000, VM_FAULT_HINDEX_MASK = (__force vm_fault_t)0x00f0000, + VM_FAULT_ARCH_0 = (__force vm_fault_t)0x0100000, + VM_FAULT_ARCH_1 = (__force vm_fault_t)0x0200000, + VM_FAULT_ARCH_2 = (__force vm_fault_t)0x0400000, + VM_FAULT_ARCH_3 = (__force vm_fault_t)0x0800000, + VM_FAULT_ARCH_4 = (__force vm_fault_t)0x1000000, }; /* Encode hstate index for a hwpoisoned large page */ @@ -977,7 +983,12 @@ enum vm_fault_reason { { VM_FAULT_RETRY, "RETRY" }, \ { VM_FAULT_FALLBACK, "FALLBACK" }, \ { VM_FAULT_DONE_COW, "DONE_COW" }, \ - { VM_FAULT_NEEDDSYNC, "NEEDDSYNC" } + { VM_FAULT_NEEDDSYNC, "NEEDDSYNC" }, \ + { VM_FAULT_ARCH_0, "ARCH_0" }, \ + { VM_FAULT_ARCH_1, "ARCH_1" }, \ + { VM_FAULT_ARCH_2, "ARCH_2" }, \ + { VM_FAULT_ARCH_3, "ARCH_3" }, \ + { VM_FAULT_ARCH_4, "ARCH_4" }, \ struct vm_special_mapping { const char *name; /* The name, e.g. "[vdso]". */ From patchwork Wed Mar 15 03:03:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 13175249 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 E8AE7C76196 for ; Wed, 15 Mar 2023 03:06: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:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FoV/grwmM5X0ol3iGR7pr7NGnI/JKTQnjn/V3cJpOBQ=; b=J/efQ69K4Ff/r2 epbABMaCt+PFQmX0ahhoanik5pGRhiyoAhk+zM5yPLBwFuSPvShyx/K3xeRRiZ/lb7QQNhoLPDyVs FPMYjDrI7r/m2SgWNzg/9NV7ZKS4lAg4o+CCATOqdIweS1QrtK/tpzyOrxIqYTNh0dgbxqytLh4ye IAHdf+uOAg7s5Dh5xfvkJz9F3/fKgLoffygcNkOCfUPY4oFwVbl524ssyjYamzMD8lsOO/AsnWS+t wsKtvLZ/k+4+bJqddVaKvJ4X+o+C9W2QLO3x1qYlsRvPCmKQ77BI9c2niQVPi+ZUpZgMvWRvtxhF3 wbRDgHxiCWxQWmpttFwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcHSV-00C6og-2W; Wed, 15 Mar 2023 03:05:47 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcHSF-00C6i3-2F for linux-arm-kernel@lists.infradead.org; Wed, 15 Mar 2023 03:05:34 +0000 Received: by mail-pg1-x52d.google.com with SMTP id q189so10030210pga.9 for ; Tue, 14 Mar 2023 20:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1678849530; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=0CSfwyQHlQ4M4jXaSH+LdMi3uBUPZy3NPttk2ev1MeM=; b=4mZhqkrZl2MkO6B6mqEDLTirH3SlLVvooXtpQuTuH/xzUmMWO0qlG33s8kcsf8vR+X 1FoOK2Rk0bJmVb+8FuKG/2Jxjnt0oUDaFG+VqsxM9hrbjvOV2ZarD+HZLutU5YIiAVXL IZDZQgKVdEkHiqO2TWB2SNLAlsr0Wiul9s5npuCAjeBOJ5joViCl/33dOtfcuNA0qTKJ wI89dyMtuHkmCnCcbUMyMFUQHfyAxxbiJrKXeydYHQhFoxpswgDnmjyFK1K2t7/bFmGC dvm2FAw3pTK46SBSowzA4dhLd1uqkTrpZPHWJKiwmyDolqIdJoRm8AiDKGHFgfo1NVtm xglA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678849530; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0CSfwyQHlQ4M4jXaSH+LdMi3uBUPZy3NPttk2ev1MeM=; b=P/rZBwhf85Zcd+nNii2gEm2u6sQ65lCE87LiSaRckWI/eU9qE7kMtbCKgbdw+RZety G0qeArcWc1cbM5oduwwUwY9QpHiOoFgMI1TLoDQ0PMuy6VAHiPcowcs76KmGe9/Y3iYS u/Zjk+cqAyBAUsNk0FEmJS+sQTmcIcZPy8IQ8DW15WonTFZmPPtq/Vxf0l05/Wjma9Sj O4caE2zZb2ce7uW2ropeu+AqjTSZHVbt7m1cvKt7hY1dRADmc9JtC94L9sKcx/cjrUFS f4Pnhc2pVj3ymUPrmcJkTe/QtSH2CgB9SrixkM0u5PhW3w7fTCe7JVCjAs7+2aMzo1u+ rpvg== X-Gm-Message-State: AO0yUKWbFGSU27673UuvqtwWxOOxP/Hmyz6qXWQCe/0FC6JfFNX+pXcH I/1oI9vZGoJmPrL3+wrJa8P8sA== X-Google-Smtp-Source: AK7set9ZnZdofrFWQ0U8lJyHxwjbzhYXBh8dBYrjkL6TD0h/9D1nJL1aS2SUyiziKQzZO7kTArkNIA== X-Received: by 2002:a62:18c8:0:b0:622:bdec:d49 with SMTP id 191-20020a6218c8000000b00622bdec0d49mr9133281pfy.11.1678849529904; Tue, 14 Mar 2023 20:05:29 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id o6-20020a63f146000000b0050376cedb3asm2230300pgk.24.2023.03.14.20.05.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 20:05:29 -0700 (PDT) Subject: [PATCH v2 4/6] RISC-V: fault: Convert to VM_FAULT_ARCH_* codes Date: Tue, 14 Mar 2023 20:03:57 -0700 Message-Id: <20230315030359.14162-5-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315030359.14162-1-palmer@rivosinc.com> References: <20230315030359.14162-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Palmer Dabbelt From: Palmer Dabbelt To: akpm@linux-foundation.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230314_200531_765917_1AEFE7B0 X-CRM114-Status: GOOD ( 11.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These conflict with VM_FAULT_HINDEX_MASK, so move to some designated arch-specific values. Signed-off-by: Palmer Dabbelt --- arch/riscv/mm/fault.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index 0a8c9afeee22..5b035c0ae782 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -202,8 +202,8 @@ static inline bool access_error(unsigned long cause, struct vm_area_struct *vma) return false; } -#define VM_FAULT_BADMAP ((__force vm_fault_t)0x010000) -#define VM_FAULT_BADACCESS ((__force vm_fault_t)0x020000) +#define VM_FAULT_BADMAP VM_FAULT_ARCH_0 +#define VM_FAULT_BADACCESS VM_FAULT_ARCH_1 static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int mm_flags, struct pt_regs *regs) From patchwork Wed Mar 15 03:03:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 13175247 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 C53E0C6FD1D for ; Wed, 15 Mar 2023 03:06:38 +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:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S22oN13QK+jt6krOtPISGo/XGM0IJJqGkbaO8WG3dhw=; b=EU7NX8a6MeqO7E YQ6mLkapd75xgRxbSYX3Om6Jk7P0tae1EmTAiQNz5O/p87YyB42FFugTsdv2LIZoLH3ovZbm/MCYV qZftFvW3tjenhGno1ptxxSuMSVlhn3Bbt/1trCt3105Zk9GRv/BMp1nc1foEiL6yqxE8rb94IVWzS IuaNt+A7SO1TAmPMX/xo6bu9YZIrsGDPxotEgry9/puDQXqfkT0s3eH9029vFSGT4KuooT9qLTCah 1S6qJWoQJuA05rhQ7rc1kEr8SPQYiKq0e0nbQFSgb0tEnMTqgQtdYyIPimJWS4G+Wn37ZzJM9iRAc r0hl648KOmlgc8VuYCjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcHSY-00C6q2-2S; Wed, 15 Mar 2023 03:05:50 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcHSI-00C6j0-01 for linux-arm-kernel@lists.infradead.org; Wed, 15 Mar 2023 03:05:36 +0000 Received: by mail-pl1-x631.google.com with SMTP id i5so18654299pla.2 for ; Tue, 14 Mar 2023 20:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1678849531; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=G7SkdlXoEaWhStocARTpgdbab7cejcOgFmxzTVFGnrs=; b=gbSrb4xKWKUDpev+5xTldKtMAFbHj3vLwF3cqvdmErbeXSowCRx3W1Kku5VNtF25hQ JGkCLa2+KeTI18PILqbYkEHjYMXhVfMCNMqgjJpNLqUaCjh9zvONRwuCi/E/YW4FmmML REtcE7XQJ857RwYQlk6ALlq0ZQyrnFYldifPs5Jz+dyuB6eKFWhEduRI01G30w/4EfT1 1Zrdtjd+hz2mImHV62PQNbWSbo7NIeuj61fPS4UZRIH4BIrNvbJhqdFctPR80fXQ8Ma6 7SAbNL/Xuhqf/qhPu11eD9USle9U7StUR3J1PIzOw1/jd6mYdDgvCWR6PHnQYw0mTs8Y uSHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678849531; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G7SkdlXoEaWhStocARTpgdbab7cejcOgFmxzTVFGnrs=; b=cMJIx5PasKzhTDpiO7BKzT8SvA9fNl/nccyuxxiEKfkX2c+kvNnfQuVvLeLvlm8N0h g8Av9mDBNsQoaES90bTa21h4O5bmD2PVTtjfZcnCI/7iTxISG09AaI0piVMSTuWNjDmb OhU3CcgSogy5RumxzSKsqU2oMnAXuC5unhWMnHMDXwMCevFjcBGX1es7XPD+CPw5oaFM EYRQ/e2OVfU1MDjx+YSMQOXgsuyFByIHjNOPqFCkWBlFkJCt1yX8HWdxcYZuiJGUPUv5 r7AYq1gEao4oCGUdNcciaN2spkmsgLjBTyyegTv0OWHWR6pEHK9ftdwBZ3eEUkajgo9O S56Q== X-Gm-Message-State: AO0yUKVcLMDacmfh7QEQYVEab2wfrLiedUZa7AL/dMvIoXbl2FYSwKc7 M+CiGUpmoFt3ug/6/Oz0XruHkQ== X-Google-Smtp-Source: AK7set/LWO7bSRcbqzHLXpJ39gzf25G0Nz1mn+fYaEHT27G9psc0wa3GwCdvpFZwdrwZQMOaakTGEQ== X-Received: by 2002:a17:90a:f3ca:b0:23d:3a3f:950b with SMTP id ha10-20020a17090af3ca00b0023d3a3f950bmr3857400pjb.22.1678849531021; Tue, 14 Mar 2023 20:05:31 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id h18-20020a63c012000000b0050927cb606asm2185261pgg.13.2023.03.14.20.05.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 20:05:30 -0700 (PDT) Subject: [PATCH v2 5/6] arm: fault: Convert to VM_FAULT_ARCH_* codes Date: Tue, 14 Mar 2023 20:03:58 -0700 Message-Id: <20230315030359.14162-6-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315030359.14162-1-palmer@rivosinc.com> References: <20230315030359.14162-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Palmer Dabbelt From: Palmer Dabbelt To: akpm@linux-foundation.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230314_200534_048347_AD5E218B X-CRM114-Status: GOOD ( 11.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These conflict with VM_FAULT_HINDEX_MASK, so move to some designated arch-specific values. Signed-off-by: Palmer Dabbelt --- arch/arm/mm/fault.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 2418f1efabd8..c57ea332ca97 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -216,8 +216,8 @@ void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs) } #ifdef CONFIG_MMU -#define VM_FAULT_BADMAP ((__force vm_fault_t)0x010000) -#define VM_FAULT_BADACCESS ((__force vm_fault_t)0x020000) +#define VM_FAULT_BADMAP VM_FAULT_ARCH_0 +#define VM_FAULT_BADACCESS VM_FAULT_ARCH_1 static inline bool is_permission_fault(unsigned int fsr) { From patchwork Wed Mar 15 03:03:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 13175266 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 2F934C61DA4 for ; Wed, 15 Mar 2023 03:46:23 +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:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2JtUSByruLKshZrTvkrGWMMa5qbE77ItCT6OH8ULuA8=; b=4jJ0nWXJYIgVH2 CksOIfoho0gupQb/4odWehUNcqCBHmLZ5SVE0IzbdWsWTSX5om6PRI/opzQk0ZwWCOs50Yixptv7u AfF32m2u4h3oa2GB7MVFnfwXLA2jaEzqNbdcfPDWE/uvy+DYtUbYQ4hodRe2MdpAC/S1htgS2DoUh 9CW7/XuZIe2YNbaaYCx/F4sZlSa+lihTSvqBJcl7gv4Q1zrXAcnhQtnjYzXGeQuhQv7icbcdtj6Ds K37qD2LI0v5Py4JXETz6cQjXTxVCQ80JjZFk6YpLERZBwg8SxUuh3gYHjRtrYToG0froxz2p42gOH apgCfPgSiS6hcE6gtMsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcI4y-00CBw4-0m; Wed, 15 Mar 2023 03:45:32 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcI4x-00CBve-0A for linux-arm-kernel@bombadil.infradead.org; Wed, 15 Mar 2023 03:45:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=To:From:Cc:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=aOZC9xlq5oK9zfHrbfD1I5w67GRN7lAgeCV10VaVF3k=; b=k8BvQgFyNGWuw2ZiefxHbbg1XP q5f5PnkoxjxMCjL5LtXMo0I/+hFXoAh1rlB2l5rC0UiPUIWmyFlYMhSotmXInoMl8IRush+MeEt8q QGVEJ/sUmQQI0wrgmvihDrU7t/ftgMS+1Cr0oQPVz+dOKHzwLDWEKdoOXbuHyyv7YclBihxtnJNBO JKlLljtH+ZNpS25OvqlG3lobsAIVNSYSnliSZ0liedgjBHwJuU7F59QYkqX5eR3InhN3wNcjnCOjr 0nAC6wV1vCp9kCgkifAN4FjawhxPuRfGR/ZhR4nYCC8FNuS5i52rlGBmWeinJbr3A1LJoa5K78YHh ASvpJxYw==; Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcHSK-001zEn-34 for linux-arm-kernel@lists.infradead.org; Wed, 15 Mar 2023 03:05:41 +0000 Received: by mail-pj1-x102b.google.com with SMTP id e15-20020a17090ac20f00b0023d1b009f52so453827pjt.2 for ; Tue, 14 Mar 2023 20:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1678849532; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=aOZC9xlq5oK9zfHrbfD1I5w67GRN7lAgeCV10VaVF3k=; b=K9waOzhTSocf5S/wDOQBDgV8dv2EBbrWlB6icT3n3eOn3aBwCzE1quBWWS5eLBl43v 2GIX8VAElVK01zF7Q159vC0+esGvSNVEgVo1krYdOpl58TPEA72YrMA4t5AldEkXWuvT d8RLRXgJUdL5i/Q9N7TPgh6s0Dd6c0p3dhRvCjQbX4bcG+gYii0edSeZeYzcTH5W4OFX 5zBs70RjyU2IUiz+9csHcPQxfGOe01e4ihaZj84AhEovkIliRoH0+xNZddmNKkpvvRYq NnRXeKLrhnhS7VS97vZc9U4pYx0wGeJV79JPP30ZFOtR587Idcxeo3jvJJsC3P0+Jxsn Ztcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678849532; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aOZC9xlq5oK9zfHrbfD1I5w67GRN7lAgeCV10VaVF3k=; b=uChcHq8SuA2h2MGb87+41oEqbWhimgeNfuOFkpf0AjEScQHYmdJnTiMvSfLP6HsCvw BjWfE1jSJR4fjZVocbrd4Kp86afuT553nDIc/G3f+iBb6T9paE7OFC8hVUAsCAt5mloJ kMLS5lIxNGbDtnnn677A8tVjl9tYGqqq+qmAn6SI5BUqh5T7FQUuqrp2RdNYT/pmjXkE gV4PJQaQmYXXnUpjjfcF7n0LejbDUASm6CPzcvWf6syMJ7t3WAmtTvxNN33UTYtEw76N iFyh+z6qQttHm3dHwQePrbCgkcLUC/wqrj4j4Ey6goQV4+AcklAwSp+rWgq/4xKDjFRs i4Pg== X-Gm-Message-State: AO0yUKVKquuDplmCz22qYU1tx5gQLuiEFKco/oXVaZ2jAayh9crR/n5Z 8bzdqy7Z6ubSYK80H9d3/AQlyQ== X-Google-Smtp-Source: AK7set9kCiiyWzQ3igLEvZCSypTckIX+ebt5Tmlk9BmpkJZJwcIqMSFzq7VaBKi++BxTMFzZG1Gyrw== X-Received: by 2002:a17:903:138b:b0:19f:3e7a:4290 with SMTP id jx11-20020a170903138b00b0019f3e7a4290mr890658plb.17.1678849532243; Tue, 14 Mar 2023 20:05:32 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id u7-20020a17090341c700b0019460ac7c6asm2406194ple.283.2023.03.14.20.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 20:05:31 -0700 (PDT) Subject: [PATCH v2 6/6] s390: fault: Convert to VM_FAULT_ARCH_* codes Date: Tue, 14 Mar 2023 20:03:59 -0700 Message-Id: <20230315030359.14162-7-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315030359.14162-1-palmer@rivosinc.com> References: <20230315030359.14162-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Palmer Dabbelt From: Palmer Dabbelt To: akpm@linux-foundation.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230315_030537_502364_86B37BFD X-CRM114-Status: GOOD ( 11.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These conflict with VM_FAULT_HINDEX_MASK, so move to some designated arch-specific values. Signed-off-by: Palmer Dabbelt --- arch/s390/mm/fault.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index a2632fd97d00..f1a186a4c465 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -50,11 +50,11 @@ * Allocate private vm_fault_reason from top. Please make sure it won't * collide with vm_fault_reason. */ -#define VM_FAULT_BADCONTEXT ((__force vm_fault_t)0x80000000) -#define VM_FAULT_BADMAP ((__force vm_fault_t)0x40000000) -#define VM_FAULT_BADACCESS ((__force vm_fault_t)0x20000000) -#define VM_FAULT_SIGNAL ((__force vm_fault_t)0x10000000) -#define VM_FAULT_PFAULT ((__force vm_fault_t)0x8000000) +#define VM_FAULT_BADCONTEXT VM_FAULT_ARCH_0 +#define VM_FAULT_BADMAP VM_FAULT_ARCH_1 +#define VM_FAULT_BADACCESS VM_FAULT_ARCH_2 +#define VM_FAULT_SIGNAL VM_FAULT_ARCH_3 +#define VM_FAULT_PFAULT VM_FAULT_ARCH_4 enum fault_type { KERNEL_FAULT,