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: 13175240 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE1F3C7618D for ; Wed, 15 Mar 2023 03:05:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62BE98E0003; Tue, 14 Mar 2023 23:05:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D76E8E0001; Tue, 14 Mar 2023 23:05:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 450DF8E0003; Tue, 14 Mar 2023 23:05:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 379018E0001 for ; Tue, 14 Mar 2023 23:05:30 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 04883AAA14 for ; Wed, 15 Mar 2023 03:05:29 +0000 (UTC) X-FDA: 80569642020.28.B013C98 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf02.hostedemail.com (Postfix) with ESMTP id 2B90D80009 for ; Wed, 15 Mar 2023 03:05:27 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=hZOWobSL; spf=pass (imf02.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=palmer@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678849528; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hPLiCKdxpc2r5PKNkHmqRCNmdb24wQijBhgYpLkC43U=; b=sGY37W0F9FkjuyMeA2gEpliJIfWphpK94S11Kzfwa0GdzN2paNtd+CTZeB5TFoNyq8T8ia o8e1iWmD5CXGt0O2XPPQ8lHopl1zmxNYHy83i4H3OEl5kFR8PNjLw9xQVfeBFfK63RWDgI XQNw2SKrvrV/KFeHpVBKUlNjhVNY77E= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=hZOWobSL; spf=pass (imf02.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=palmer@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678849528; a=rsa-sha256; cv=none; b=YoWyMQDRv1DF4WQzrgn52tYsb/DHSftui/e+M14yIy1Gyzm1ZO2RfUIsR2M60aFesTBHFe HOwqbr/fhETGuDCj8TNz3paXpTAwvmgoGeZEpebHohJTQ7oyXxz41fj5go5zuWdzJAnL+j g3ZMNR0Z93CMckYP/XOGteRtdSW7yTg= Received: by mail-pj1-f51.google.com with SMTP id y15-20020a17090aa40f00b00237ad8ee3a0so466344pjp.2 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=KM8lday4dOUgBPo2a0hkYQtPMknaWuHvIn93/FcRDEiiCYMjs4z/A4At+/vCSLwy/E SJoxrTAU6X7iVT7AsPd5K3ZSkmBu+GOZTd0BajFBW2FeMWQNhKiPTgtzpcH505naYUSU Tfvt6W7gSkSOD9gjmOOcSnBZgOy/6GoFks46BC9sOOkRqRt3oPAMio57/kYncNmybMx5 Mstz4ZgbzNOfVIHGrqPqHzGXpDwZEZLREKTGEiTlmivpEUlz+hDuySxXLmYTklwNteC1 Z4ZZfZ+iZSIsfHv/ETkqu/OaeAtE5EeVHLuMyiY8uulY0lIs4z6Ppxa6DZ94duRvcQZK tsag== X-Gm-Message-State: AO0yUKV3nHhJf1rvtRjLgqrmHbj/gD0ObRQ0MW+jtbNGuw2s5bZ0VLgU Db/+lUjmYFgU1uNA233AOV14LrmZY9KMJnhnMe0= 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-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2B90D80009 X-Stat-Signature: dkgu5xpno714cd6fxzbcxdij83h8gpfj X-Rspam-User: X-HE-Tag: 1678849527-957091 X-HE-Meta: U2FsdGVkX1/E8alQJcg2RHW+BmefYb5sjnBXfGUJQ6/cpYevoI7/TCxRK5Gy8PqSIoxXbe+OZ8h0ZRadANnb/lyqFBgHuDpHWe4Sxip+HuKC4vyeZiCggczTr3LJ+byW7eyYLvMj4oHjDhRPChHn6HQ/6FM06uk+j2Vsns3qevNjq0cucLOEh1rG/nqsflzeXbwXR2gSUjCh/nHkUj4WmcFGivCZb1x2f89qIZ5fXHSEHA4MPcezCRJ4TCnghr5sSa0skuHQX+FbV/3019uZ41Vy1O6N46WL7rDKQMcFY9OjJroLmc2sYVnFMsQKQKcaiAq9QEZN+HumtKFB/Ef7EJUd07CcTR5Bg+GU2AbD1KfwkevGoGsM5z9tSxV3CwXTLhcXwjnkNE4OnB+HdJ4gvuj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Ckf4KOcbNxPhtg4eGXpM4kw/u0ruLs1G8/IpZjAlC3YNoQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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: 13175242 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 721C6C76195 for ; Wed, 15 Mar 2023 03:05:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2367C8E0005; Tue, 14 Mar 2023 23:05:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B9FE8E0001; Tue, 14 Mar 2023 23:05:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 05AA98E0005; Tue, 14 Mar 2023 23:05:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E9CB18E0001 for ; Tue, 14 Mar 2023 23:05:30 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AE5E7AB060 for ; Wed, 15 Mar 2023 03:05:30 +0000 (UTC) X-FDA: 80569642020.21.D66B23F Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf09.hostedemail.com (Postfix) with ESMTP id EEACC140013 for ; Wed, 15 Mar 2023 03:05:28 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=TBNUeSBf; spf=pass (imf09.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=palmer@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678849529; a=rsa-sha256; cv=none; b=IioiNm1aMnSK/eLyKtjHEEs3aOMlityX7Brc1TB2+fmVN+J1ymIyTUZLVh9DBV8a/JsfLG eQ3q1N3lYhcgoogrhzLzBBpcl9rR6/Tu6lucE0bx5WECOleU+2VADiqvcbqXaU9YUwamx5 Btq3/v5pxzbUaVZwQAWAU0N0sZsqTB0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=TBNUeSBf; spf=pass (imf09.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=palmer@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678849529; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nnoQUwQmFqPgSrJHWK8d2p9DXhKQ1/cuEoil7CNd3DE=; b=VNptd2XWBj2X9VwRiHEveEpXUf6Y5mvhGL+9E4N5zAk5tm2zYxgIgFWp9ZsNoiP97k7Yu/ niuGE/DVghIlQ7fzmEeOej/r7NWAAtgZInP8noeW6KFum5CAyeFLu2mb7WANzJIvTIJfgP DJYoZCQW3plW6RAdFXrcIxSSYook58E= Received: by mail-pj1-f41.google.com with SMTP id d13so7324207pjh.0 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=S1/FauIfJHOn8WRnVqI3loiuULgYLsonGGj2O1QxrpUqm0oW2rm3nynl7INge0tNBF aLzFI6UxBJCZrhMHLShZu5CQhLnUBP9o8AWvH1PU4MeIDXSynz35NYKhlz30L3s/3/+5 ktgSE3mrktq07jzZEw2OCJLZFE6vQoWHAVsf7mLNGAshAbM9/PUy5ruLMmYCuCvyy/QB O5siObaYplHWcGu2qW/KYOth1gPoQ0MdQtWA4r7eXJgeR4pq9ZAcjnGaZGz2rycghqfx Rf2ed/McRRqjL+DDCSZIbZMSluVEGBpTS95samuUkOfe9xGIdGeI7E6VhINO/T1/sO6r xMOA== X-Gm-Message-State: AO0yUKW7peIqqKTAXiebVihTnvi4RwSG6R0A4k0GykPJhCrqDt5GmDid 8lna5SysskPJRqclQbeNxPppqPEIwxNiR+Fr8PM= 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-Rspam-User: X-Rspamd-Queue-Id: EEACC140013 X-Rspamd-Server: rspam01 X-Stat-Signature: gdue94ts3egfdpwdopgp545b6oe6wqkn X-HE-Tag: 1678849528-244659 X-HE-Meta: U2FsdGVkX19gwnFvgOds97eGtYmeSPEKpxttecSElmFefauJ1QKB/Qp+Zmi9MmW2nu3/U+llcVZ1xD2a//Sk2oW7+UeY+JJV8GQs4ydaat2vDHLi9Y79uV3oB00yxOUdKn1FuMFEBiwvova0ry0ssTSRSJbLUhN5TF89sWYe/ocA/M4Ri8F3fJ93bYgdwHulj3pB7JE62YWovXxSP7QIy7gbpDb9I5QLP8hhB2RtlMYcp40aw7vKkbcd09Z6I/VKD++oOs7RL4bgqt5bzBZVOwQeiMpd6Ef+YPdeztCndVsbXHmhd6lBF70tVL9eREmSQSUBTkSGuXrDRf7Arg9sXNKY92pEhR+YVteBlPoEkLVXhDuxICBVrK1Fpa9tCUhKK4THIjEJ/jTzb9qMeX0RjTFU24sK26cvU7XNbil4jDJZOkJls6SJdwWYMbJ7t7Khb94qLeCvsIocxeT+WoZuI9P7SFqjqsxP5CQKLw8Af5Cq2+04Thbit50GN4/br7mSMdYyqnOA9kZLmEJw5if2RkAlLwNcczbfSTJoTdY97BZd8CDm6T/PSOxwjWGdq8VnKPS5D3rkp//eyd2JbEIUa7aGri/+ggsHanvAUlNRFx0zhm8kNvQa8Ac2kjrCPo1tjUcFUmCVCdClUaRyriEfAbfIWdtJVCoJrdklW9+hI02vWM5lRW5NzaonhcfVmRfp6ihQM3kVfvKxmfZgj1/gmtRtmTy2vAtiTXB0u6Z0VSaXpPPVT7sVhpqRIRIOQdm0wf9QhDi1uaWViOdDGxzMVZ3q7alL4uYJoZw4AwiUoQcVqUjW/7dWdhjhvj+6RWB3AfwLgrQX93pmwX6ZgB67Bq/vArDW1nIzuCau5S4cHQ+EdfMn1S63EOK2wpJHthI+DWibQFW7afyn4Gu/W/zBu2px55/QiFXMUKjTq9S8pCxrPGyjWREOh8p623MrmOvi2eTE//srJ1x2W60cb/w eu0RvvSc Onk18oVQI4rl8lhtGr0e7Csot5BylZeROsC5VArfPIuzl+f7KcENDbYKSInXrG0nd0x0/tSZ9wvKoPE1jqyykMSVQa1KGzoYddznelp0pHYMsoDbv0EW1lJxfKmTC4LCBG+sWOHyC3Ad8KkFzNg2HcBmRztMMOOh/seqYyOdJ1nZ8q/mqrmBHyYJHCXCSzwkNo469g1weG7W75IbYwI7eQW9SgeA8h/HUjAuSXPdWP9+O5nSwhPHnrlF4cwC0eErBUHCDH9jb5KLoMnFYXfVPdNiykfrUTqTP48qEF8fiyppG77h4GypkRthGV8qNvlRijGlQcA4y2yiiqmiB4iEuGFgGcK+E4bXXW62rE3D+0zlb6v/Y1oH9HJkN8lveJ4iOZbeI1c6NGA3RXgG9s1CK8U6FX+K+97iRYHEjAripf3dq5ciEWXAbslxUv6KSiB45i3G1HwhltWlKCgpT3wFsXRMBTd8dI/SFWcd55c24H+x43hAMSC3bUASOJiNwvz9qLWJ7 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001969, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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: 13175255 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 236C3C6FD1D for ; Wed, 15 Mar 2023 03:13:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A67E26B0072; Tue, 14 Mar 2023 23:13:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9EFB96B0074; Tue, 14 Mar 2023 23:13:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8908A6B0075; Tue, 14 Mar 2023 23:13:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 763D46B0072 for ; Tue, 14 Mar 2023 23:13:34 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 404011A0233 for ; Wed, 15 Mar 2023 03:13:34 +0000 (UTC) X-FDA: 80569662348.21.6EF8D6E Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by imf20.hostedemail.com (Postfix) with ESMTP id 712631C0003 for ; Wed, 15 Mar 2023 03:13:32 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=qEfXoxWo; spf=pass (imf20.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.219.47 as permitted sender) smtp.mailfrom=palmer@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678850012; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kjXs6Q9el+E3DjFj75yzzOPO7Ucq3PFGsjms6Llyx9A=; b=LyXE3tJFM/PblafFnhf8n/vWeAmt0sFe2FkUf7/Z04dYGad9rVwNuHQeHqhYG5OFiSsCdQ F+TrSrX+SkD97jjUAujtnTcymZCWe+fXJJ9K+clFlR65N6VFzntFKG1JB57tyNXMWTH0zq rxcaDd2AvsSDCM0+Phwuh8iZ7TSfABY= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=qEfXoxWo; spf=pass (imf20.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.219.47 as permitted sender) smtp.mailfrom=palmer@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678850012; a=rsa-sha256; cv=none; b=dB29vMNn/D2SOQIRKNE2nogkowgIL9j44CsOJ6S859GFc5FADlNijjm0kpSek1nDqU/Vra MsHB04aubt4n1PzEO03jjeRWGgrXUWlbEj6za7qXDKRyfo1Rl2CX2GdbTEEOgdE6lMAXIV 5S4x0q6rL0oo0sPDdpuLT1EnNOcsG2I= Received: by mail-qv1-f47.google.com with SMTP id jl13so10716401qvb.10 for ; Tue, 14 Mar 2023 20:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1678850011; 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=qEfXoxWoyd5DDYIHeqmYdjDmd91+zHbvBrTblyjeTdMwGXEJ/DVO3axUAO4C+IebS7 91oC15hDpSMEWau3u3S9EDBbYzkc1o8MLbUvPJsuiDXeri2BSa2B8RM915XaykRhHdLr fT4uSIQXISNyxGQHZ3xSNctJtTpOEr+xZojKsBzj+4EY6nHobYl60fkM4gcFehU/90xs ZVzB5rgRU0nU0o1JBxywGpSDjHAKBAD2URuxjiKuDZef6j23Dl+iiFsVg1i61Tnc1D3+ ZbqEFDMgMv7Fj4+OI3j0Ieok3dm3xlVtkRnUOENKzOUNbE/CCDO3qqfLmR7TSBHc0Mar Lf5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678850011; 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=qGnAV0fBDGqvYPtDTFPWlbooEM6QUvqgmYgtY8Oev9WsE1EijW37bKbb2htfolSere 0AKI/FPoQs/dwKGUReDz+ncXlTv1ncXbzZ82foxc356tZZrmnsVRF8v8GXxjDwmDhkTd QrWo/y9LiauYShr9/mjdG8NjawW65CjFP2EPXUfybdUP7TDUMX3Ajwrxg2mlkXWd5R4N 1XU+vkIs+EPC8AL3yxsBvq3lwMrJ2J4GybdpHWWzoQz7ZswVAcKU8p2E78XdcbUz/BUV Z+MZyYLKqbNnZh14Gd4nvxiwZm/EL2oN9OYV66oUuD5s7cwRDhStXHkm5lI5kCadaDcC Rw9w== X-Gm-Message-State: AO0yUKUu/IQD/3r4B4FFEmdN3OeJOmmluTmsponGp+a5fJsUi2t+6emz Mna3x22W564/ayv88e6cSPcJwG7g5TAEPqqIBRU= 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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 712631C0003 X-Rspam-User: X-Stat-Signature: ifgwf69yu5awr4kqwuj1yrd37g7cii4p X-HE-Tag: 1678850012-344270 X-HE-Meta: U2FsdGVkX19TCkK72sZp4XuI6Y7eEYzW80ovLzgA7tYV+fk/APM/v6zV32A3jru7drmUDBK1fbjuIAReSwU/kTz8iFroMjw0gasFl4XTFRkjAUGVyjDDyThJfAuujgJlSMFzFEIMZO3CXjfCRB4Qbrw7zoYE6ErFaL8jtPCujfQevYcM4jl3gotXx4qpZCt8AuIKgAyfpVyUqQx3dEuO776KKyI2goIJ3chnu+PgswV9eAhEEpm+Di3+iynODQ+0/pu8sloYYjsdg3sDkTjF4HZIddiZ2/RYWrf40sGRytTLN1zbGi5AwGncUBXXsdxj9Xf3x7/s4vdAJ1Fi6MgpUWQoiARMe3ozt0Ke4l6YUVDv2KyPuYpQ6Zb/Wr4FhYAwBXhhTRqbWPQ0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ZGgjazxYVYdKxW/z23cTPnfm3ZWM3gh5SUvVWNW X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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: 13175243 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34EFDC6FD1F for ; Wed, 15 Mar 2023 03:05:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D0F78E0006; Tue, 14 Mar 2023 23:05:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 95BF78E0001; Tue, 14 Mar 2023 23:05:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75EE58E0006; Tue, 14 Mar 2023 23:05:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 63A018E0001 for ; Tue, 14 Mar 2023 23:05:33 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3A390C0898 for ; Wed, 15 Mar 2023 03:05:33 +0000 (UTC) X-FDA: 80569642146.14.55A406F Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by imf02.hostedemail.com (Postfix) with ESMTP id 5FEAF80013 for ; Wed, 15 Mar 2023 03:05:31 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=4mZhqkrZ; dmarc=none; spf=pass (imf02.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.215.179 as permitted sender) smtp.mailfrom=palmer@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678849531; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0CSfwyQHlQ4M4jXaSH+LdMi3uBUPZy3NPttk2ev1MeM=; b=eQg9D1oXgH6CAUqECSw+HK8fhCV7Er4CDO2xOAvcZLt3g3amqMTImaCaT07TMkCyrPme33 9Tvn5Q7kNXlCAS2k+lJQWAuGKPGEkVj6Kd4hXN47GrMo7qWQwwuYJcCR5aG/x6P6xb42+f 9Iv6QALr2hvxhoqvxBr04QXYFai1/Lo= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=4mZhqkrZ; dmarc=none; spf=pass (imf02.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.215.179 as permitted sender) smtp.mailfrom=palmer@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678849531; a=rsa-sha256; cv=none; b=ort3jfzTCBU1hZPZtIAXBcElEA4XlWJrJUGNTtb/5oh+EJJo9dz7pEn206xbdbWQ34gRlF ms8vLpx8OXQ1aV/6FaFLzAd3Be6boEzkHDtYvm4gA9wBX6nrv9cmEyyQKTkq6N/pcMTeRU kALQRTEsCWjKOpg77euLiLD867CODjU= Received: by mail-pg1-f179.google.com with SMTP id s17so10034358pgv.4 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=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=QA3I0W1L2s8J6R3m2QwE44rE5cHK7u+U73uzdK3JwqqCfv+snJOG6xXFmvaWD76dhW tukwcbUWPYY5N6iH795MOZP/IMLnuNxB6ie9F8XpoflBMaRCb7GcBvyubd0APFCFFX3/ sHmed+jL8S/jBQParWvlPI5dfI7Sw9lcP/8Z0uoBY52/Zmi+QldYSAXS6d8a0uUnGWfc XMiNkvbwPyPRX9iRdIa3xp5cz3+wtTJHlmFCvOldn6x3uPxyv7Y2sdOMEEwexJUprEBt QakTaGv231l/LqrAMqhVu2TO8t29A/4VmqDtEZlrGfcPFxV1mmxptdbZmpsrb6XGPy3M oWuA== X-Gm-Message-State: AO0yUKWUB1+ejZpyweQ5d9IObu8NLD+2P5xM4fOiY2/VXKavrBACxPoY TgoKRlQdweIXxNe1r2b6bu1oVuqriQk3FOY/pHY= 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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5FEAF80013 X-Stat-Signature: ktxjsafc9jjtcas6ias7bz9cgde71fwh X-HE-Tag: 1678849531-805033 X-HE-Meta: U2FsdGVkX18weo1lX/RnCkynUmdyEpKy71m04+q6LTbf1B2fZBsSc5lB/qyky7wFPLEoyW95lpgBhrWwDu45U3FbvYU8j/m8enyum5GVRuOPQoLWYTWgNARGpse3DUFDaAnhT71UN/MtHbt8suxSSug41lrnOJOHSrNnA6BfMrp4ddm9wkRwnkUu7uoT+Hi8eznkNaBRXbr0NQdNW1uxTOtXiItrpAw0yHpR9irdAnwwlCMb2Z5abNFtZod0ghCC6j+3kTex+qk0AW50Cg3EIS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CVxW3PG0oCJH9rtFMlcWbloDIad2dKq3ERmyAYvEPr6jPZ0VO3qhfV2IwP0+/jGxKUa4WMRU0FNlSngVwLwbAtRyrEQZIGW0vIZHSWd77YvPM7Wn4dzyYmBEQd6MdeuR/kJjgYYOke0mv X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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: 13175244 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D37D0C6FD1D for ; Wed, 15 Mar 2023 03:05:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 95B668E0007; Tue, 14 Mar 2023 23:05:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BE1C8E0001; Tue, 14 Mar 2023 23:05:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6265C8E0007; Tue, 14 Mar 2023 23:05:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 531C38E0001 for ; Tue, 14 Mar 2023 23:05:34 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2603B1208BA for ; Wed, 15 Mar 2023 03:05:34 +0000 (UTC) X-FDA: 80569642188.08.EF30348 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by imf06.hostedemail.com (Postfix) with ESMTP id 5FDF2180005 for ; Wed, 15 Mar 2023 03:05:32 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=gbSrb4xK; spf=pass (imf06.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.216.54 as permitted sender) smtp.mailfrom=palmer@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678849532; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=G7SkdlXoEaWhStocARTpgdbab7cejcOgFmxzTVFGnrs=; b=RIW5wdbKk4NdvLo+pJhh6npRB2zd349Hfn5/zR3I6pwDwfRIoiwpzotJh7r0UXJvFMn/sj T2kXG/bIT9wpSK2GFv21IyuzVc9PKfthVLXFeB1ye7Yhyj4ZDYtup843bdSu2ytTLTbhQb 9SDqHlAVi/tVOwGeRDZoov2bFa4+Xpc= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=gbSrb4xK; spf=pass (imf06.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.216.54 as permitted sender) smtp.mailfrom=palmer@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678849532; a=rsa-sha256; cv=none; b=WhPR4Ey/ViT2hRsilPC+JSvU01jhqcspUoFuWLNQle2lQ5fqvPpkD20w9AtxoUAOecZCh1 hEJJfAvzgbK+F+rUL73nvp/wRcNeosf5ad44F21x4RV4nfg6pgTKtiXUKaoSD7nOKqDrtH 87sw43O+4PRNOIyHjBMEoPeeFeUxwfU= Received: by mail-pj1-f54.google.com with SMTP id j13so1623564pjd.1 for ; Tue, 14 Mar 2023 20:05:32 -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=zxwxoimF7LKESz8luIJ4YhcRZ9XvBsnVSyLQIt2wn5bS1Wd7afXDX+dt04Yz4cESHh RrHvCKGxALYdhhRTYriMuophhybqGFF3u/Nx/yAl42WD60WPNxZDp0BMbeGXLVukIsDW MTmSxRd66ZCiQCsAkXd/mPjKF5NLUXkJUeJM28AyWt8rMCE0MitaEeL9XZwVdEo2Dsd3 Vi+zIsdfTEnLiRG+YRxwmEOGYEEaT9SwcKyI30B/Rg9MdjMsUiFcrX8BFBzN/qOSOK5q yxtPAWEMC16bRDcTGWsVsqep+z7EJ8YDfBR5X5r4nO001hEjbYoCMP4cVr/fsTMHgTHM 2Alg== X-Gm-Message-State: AO0yUKUJYSfQm3aHm1deEbKced1TZWNSFmVrd24fPw5rMoDAnjwBLpbt Kcl4AnxovSVFeUH1r8grW6TwlYfkZPbqSV3x6as= 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-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: e9bho8jx7zjg7da9pdjijbkx14rezgda X-Rspamd-Queue-Id: 5FDF2180005 X-HE-Tag: 1678849532-801644 X-HE-Meta: U2FsdGVkX1+kmGS1gP4S0q5RlZ2eoR7wSM2vbxOsZpKntJQLrVES5wJ2VYXIJtdVYUV13bmXaQruI+eeW1YR1Qg0iodFrLr+4MH74Fwjm5ANtm+HFy4QKVVtuGFK3LHHC/+6HmW6APgP6QUwz78R8njBX+eyHI1J4eC8BBBPVd3J8BmOHIL+myv+z5mJvsWJeMZtmA4gT9GFjQapgiTKl6KkAU05jgiNws8OG6qPBKhPdvhoW5pCEVYgLBqbkuvP6cXKCrbxaHJTSB/K4EJBusZIjhjqprxJy4jIN5+Ne/2Eu4IB9kArUWlj6GRZ6xTZxaUNfIhEpBR10+bfiCRD9U4R0xzc2PuTH/MHmEcnc49iHk9h2nSsYaK9cV2RpyEnBKRuBXSHh7OqKJM2HMDTe/4PJa16Hg2pYCisARft4rW6rHBXd8FCIH2TlzbBtNcSEg4WKYtPM1Pnf3ITKlA0shqI8klfPM7ITevw4+BXafON3dNnuEtWVE6eO4SaszLNOvnpmXpDw0x3+VLJc+fdNBlA0MGdRK3FL7zU5Ut400MTQmcd5LHEGluqh68RxPuWwgXL59XV5gFfDSMfIslglaZBpwUjnE9ar70120R0PnGExw+5LuyhzQI+jKUE5QMRIO76UAZz5hj3frO/qto1i1cKzi2O1vgzBmcZ40z1EGdL2Fi0kmUKfxrlRA781cwRQHKvEXWE8MaC4nGdzmCLWCTteOPCtWAQC7vaNToaOQoRZdERMgTNhaMFVBdbTXJ+kwsvpqXmFvJ3h+HLwr20UVL8xOPJFOywmjQjCQMFeYrWSpoofPrYumOLdPOmVSCYPjBUJ6sPvTzNq7j+G+ZPNyTA/ry8+qETXfAREkw/mWj1rBXD0cy5bHGjoul+EUYhlGI80V0Os/unMaF3PeOJzsE906E34zkLqf37W5HKiWm/2wNDrigW8vExI3XToJeWQA8QIZlwWdULxvEFn/s UvcH2qPw 0udl5SsAAAWWGAJ9bgukDQPbEm0mBIaAAUfX6LAbWcefbEQxnfR9qH5OtiX3Dw9N7lUtqaD2n3Lpjc/jRmtg6/seQpM428+MdGXacZOa94exz7uSIjXg/fZnfiYY3Hf7E2oHkw2BvNlwCPXOPo5tH+QVLZ2q9ZFF4BMz8TU7axMGRP1CWFh6NX3bo+s5e5Wt1eB3J+1ooqjslUHsDWtCAdDJna2EEHbOmbwwpeWUiOl+rgGK0L+C2yyLv4HqpHcvIf+GKVJniVlEaue1ERaE36ykN19Nq44vZUibnATwsz9AYMqkwRXhOkeeXibaLZqwpl4cVFKvBlvRtpke5eqIjJKZ+pZoEzGr57o//PSiGdT/lLWr4Ufk5/HShqAhgDcJZ0Fd9CRVxYDWgsrzAzn/lqFqT0arBcUQDlo2B4eahi+O5DgDt30zc0XDeyWb9IWoRNn7bQuYIExzEbwP5wF1z0FJnyz4e1jmG24IFqB7D39CGq3Z6Qf7JRAQMIQVgYo9LK/iI X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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: 13175245 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FC0EC7618A for ; Wed, 15 Mar 2023 03:05:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E16E68E0008; Tue, 14 Mar 2023 23:05:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D79808E0001; Tue, 14 Mar 2023 23:05:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C45408E0008; Tue, 14 Mar 2023 23:05:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 97CDC8E0001 for ; Tue, 14 Mar 2023 23:05:35 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7671A1C6955 for ; Wed, 15 Mar 2023 03:05:35 +0000 (UTC) X-FDA: 80569642230.04.6DF7B93 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf24.hostedemail.com (Postfix) with ESMTP id 9492D180011 for ; Wed, 15 Mar 2023 03:05:33 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=K9waOzhT; spf=pass (imf24.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=palmer@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678849533; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aOZC9xlq5oK9zfHrbfD1I5w67GRN7lAgeCV10VaVF3k=; b=Wzw149eCWW9sBtrWe/eS+T8ouu7nlNQyG7OvjM6xRXqOsjJTQ6p1DZ0WUPleOwQLElD6Ud 38w+AmGIWL75NMFkQVPrT5lpjRMV4Gnlp2c6Z2CnDTBIh5WPR9G+BlaH5zhfypyd3tzeq4 IEpmwYHO2XDzGR8n2gOrgIvqS2eZXFE= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=K9waOzhT; spf=pass (imf24.hostedemail.com: domain of palmer@rivosinc.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=palmer@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678849533; a=rsa-sha256; cv=none; b=2LO+e/7ihfWplyXzuJZPzeeq8+wRYmVnrccWZQh/Gs3uo0h4o/MT2JogsexuzUaQLQhcYz kv2rjw05wsyQgWmel8j/ohtWiHHsDbmpPZKs7RXHJEHxumlEEPfPWFbZpEzbkFyNEyupow GdNp9ihDhwFIGDurNpHjyYzPWnpVrrA= Received: by mail-pl1-f178.google.com with SMTP id u5so18631481plq.7 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=W7UMGMk4c9DOYROdm1MS/ZcueIL17dfZSHQA2L/3hycQsUwAxwVNcC49h7iSeJWZGG mkEom6+DZmBWMYZyLlkrwXjahBKHLua3NSAJ4j+6ZgEwnAkf6Qkh+G5uDkkKq0P9vWrh +xVnEWNbkrrLmCBDYrzFHEzuyTGtgF1RchLOItt7S+jyDDFut/nPHipxsXssGRVksCp/ Ml7iMzwyLJfhOVZI+nptceEdcA0MAxtzNXNT3ygdo/yycGBRd2VDrF1cOYrH/5IotcnQ C0NVW5ZUx434bcAmLO0v+oBbrPtDXMxLx2LfO3c1a8jXNIkzsWT2nhDwTgKQaSpTRBEM PeSQ== X-Gm-Message-State: AO0yUKVP6w4bgG+6/MuA6ESPsE8xKNte3I40Pvy3ZjTkP6RDVTXFP9m7 KYXgCzIRMCOgwqZpo9fWaLQcew8+czyBVsOeD2I= 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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9492D180011 X-Rspam-User: X-Stat-Signature: jkproukdawomcz46mgma6tizuc66ri1u X-HE-Tag: 1678849533-396858 X-HE-Meta: U2FsdGVkX1+CHV+/k/la0YXTAjd/QN4A5UTgYh0FkuRKR8KuhDXoQPOc89tf38dvnY21ekv0DXk+fH1jPqQib7JJYiTC+rXVkICmPNHlcZRW8XhktBsDCitqyeanOhUIjY58XfjuspSVCxYtkjVj7H5Ms45If5QW9zVIpSojUkEFheB7aDvy0J4wguD/fycJ2cUkt8pDd9wdbVdQy60xELYgpikQ8OQ4L+PxNnGwIiX1TSdkiVQZFttyPJS+DP4hsvwaNiz0PQFm4XfqckNa1b3/+px4NaoNskwsFWd5h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rPRmdyWccYUrqk4QlbdHff9rTHE1/b+PB3NLNvYjZsr3Gz4ohx4skPuzys3dER0jTMBdnVjalzURkS5RKhKJrLEymEkfW19OHw3QyW3XmdD3pOLMlM4duPhhRFwLEgk6x+y X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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,