Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp59078pxb; Wed, 20 Oct 2021 16:29:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUSRQFOqH1cpjgJN0dhEq1/+NZDL1/2TkSJLzWcXjoxm+ZNY2gt32ZqRxmZil52WP0Z33q X-Received: by 2002:a17:90a:29a4:: with SMTP id h33mr2202970pjd.88.1634772554944; Wed, 20 Oct 2021 16:29:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634772554; cv=none; d=google.com; s=arc-20160816; b=occGze/zgqPA61KJ4PANFh5xfxnR5MlsQ/TKgvQks2oLJLSto4N/+8Fr1uvhF3psFp 2Ku5lc+25vOtUoDePEUcz6JRdOBmsoL1D9vYRa73y4qKHdqNRnVcvBc42sIHPIOmC6AE m0fRi+GqZxMmR+QvSWHoVpP9zOZ7XMBTlVxwvp3YUQAz5y/Gx/FluBmR4uDgjFhvDAB2 sRUP3xjwNcsyphu4E5hh6EnE9Og2D+b7Hz7gOneezIliMR4WNZHS+cZ4c5vcRA1CWCrJ mRmyA3HNMpONph87kdBWW5yaNSKzIpmkwy6GkE8LhtlIrSHWvKXIrL3lZEyNW6BXRQ1z YyWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:subject:cc:to :from:date; bh=CT+a8oVfTWtHCTTgsdqgiYohgFKyiS+WZTZEORkFbCE=; b=A1CN+c10Iv4HV3hvdU/FnqzdZkTVunNpd5ogjfzkP2ec9GF8uEcK/+ayITRvMO55dh W0nQqMxkd77aHQnRN5J4jQeIWX+KujQEXmddzx+ogjPcbbXy7eqwNnotLjKn+CjteS7D RBSWq92sh8ADlX0Z54KzGM8wd712s9XFIRFdl3EKCrG0KAR6fNKlDcBKyHuy2uh6yilJ HXSesRHm9F+TBxD1igAVqVGkh37qw+vbNEe/LPLBcwKFlovvYdAh85gducnwEBENXhB3 bJW5j1ZSMWV552rPioY204PDcHTrDAd7LpiJu72GMo3RYTEiOMLjVvLQHlqKiS9Uljvq VH+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 67si4325542pfe.369.2021.10.20.16.28.39; Wed, 20 Oct 2021 16:29:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230478AbhJTX3P (ORCPT + 99 others); Wed, 20 Oct 2021 19:29:15 -0400 Received: from angie.orcam.me.uk ([78.133.224.34]:34244 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbhJTX3O (ORCPT ); Wed, 20 Oct 2021 19:29:14 -0400 Received: by angie.orcam.me.uk (Postfix, from userid 500) id 680DA92009C; Thu, 21 Oct 2021 01:26:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 5AA0E92009B; Thu, 21 Oct 2021 01:26:57 +0200 (CEST) Date: Thu, 21 Oct 2021 01:26:57 +0200 (CEST) From: "Maciej W. Rozycki" To: Thomas Bogendoerfer cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] MIPS: Fix assembly error from MIPSr2 code used within MIPS_ISA_ARCH_LEVEL Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix assembly errors like: {standard input}: Assembler messages: {standard input}:287: Error: opcode not supported on this processor: mips3 (mips3) `dins $10,$7,32,32' {standard input}:680: Error: opcode not supported on this processor: mips3 (mips3) `dins $10,$7,32,32' {standard input}:1274: Error: opcode not supported on this processor: mips3 (mips3) `dins $12,$9,32,32' {standard input}:2175: Error: opcode not supported on this processor: mips3 (mips3) `dins $10,$7,32,32' make[1]: *** [scripts/Makefile.build:277: mm/highmem.o] Error 1 with code produced from `__cmpxchg64' for MIPS64r2 configurations. This is due to MIPS_ISA_ARCH_LEVEL downgrading the assembly architecture to `r4000' for MIPS64r2 configurations while there is a block of code containing a DINS MIPS64r2 instruction conditionalized on MIPS_ISA_REV >= 2 within the scope of the downgrade. The assembly architecture override is only there for the LLD/SCD instructions, so fix the problem by wrapping these instructions on their own only, following the practice established with commit cfd54de3b0e4 ("MIPS: Avoid move psuedo-instruction whilst using MIPS_ISA_LEVEL") and commit 378ed6f0e3c5 ("MIPS: Avoid using .set mips0 to restore ISA"). Reported-by: kernel test robot Signed-off-by: Maciej W. Rozycki Fixes: c7e2d71dda7a ("MIPS: Fix set_pte() for Netlogic XLR using cmpxchg64()") Cc: stable@vger.kernel.org # v5.1+ --- arch/mips/include/asm/cmpxchg.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) linux-mips-cmpxchg64-isa-arch-level.diff Index: linux-test/arch/mips/include/asm/cmpxchg.h =================================================================== --- linux-test.orig/arch/mips/include/asm/cmpxchg.h +++ linux-test/arch/mips/include/asm/cmpxchg.h @@ -244,11 +244,12 @@ static inline unsigned long __cmpxchg64( local_irq_save(flags); asm volatile( + " " __SYNC(full, loongson3_war) " \n" " .set push \n" " .set " MIPS_ISA_ARCH_LEVEL " \n" /* Load 64 bits from ptr */ - " " __SYNC(full, loongson3_war) " \n" "1: lld %L0, %3 # __cmpxchg64 \n" + " .set pop \n" /* * Split the 64 bit value we loaded into the 2 registers that hold the * ret variable. @@ -276,11 +277,13 @@ static inline unsigned long __cmpxchg64( " or %L1, %L1, $at \n" " .set at \n" # endif + " .set push \n" + " .set " MIPS_ISA_ARCH_LEVEL " \n" /* Attempt to store new at ptr */ " scd %L1, %2 \n" + " .set pop \n" /* If we failed, loop! */ "\t" __SC_BEQZ "%L1, 1b \n" - " .set pop \n" "2: " __SYNC(full, loongson3_war) " \n" : "=&r"(ret), "=&r"(tmp),