From patchwork Thu Dec 6 15:57:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153043 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp10696005ljp; Thu, 6 Dec 2018 07:59:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/WWAUwxU/FGgZM261jz7rRS8zKF1SqDoRdFl6QiLpvFsCriiDuFJiphRnjLloYViIDHS9iK X-Received: by 2002:a17:902:a83:: with SMTP id 3mr26920327plp.276.1544111995308; Thu, 06 Dec 2018 07:59:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544111995; cv=none; d=google.com; s=arc-20160816; b=YWH3uIRxCRPAxFVWHctRkRUJkNBat321x/9Wp8bjKxIb0+1AK8Wi5uqsihGHuoAP8I 991N4cueGzNTbIbY5gEeW5QaD60I9nPfX+xx/TDb5/XNhxBpBRGw70csVle1WvMb5hB/ cFbuLBh38R6sWuxHtpRQU3HDiTvMVonIG9d0p6YQCZH16TTeoL4FgGVKT1y9Bb2e6vWl zIyXUDdo6TeRPm/kV/g5hJnxmqeOcvNuivHuvQcI/vNmEFEuPCAmIYCrBaBJb2XLxLGP f2Ac9aDGWbyYuhyFLtPTciGiwd8llYgRdloo+LVSpDREeO8moM8PF7s1gE2ADB0k/REr foGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YAJ/pSqxHadg9FAalxrP9XtBWK91iIUrnuOMWYKHTIQ=; b=G9r5UYvSnggeT0xAM8oOUFdCSgA7WZZwOy/jfcR6O29N/ua3Hg/20U7ZGrzFCevst0 2usrd4oWxhSn8BvezmBYc5a+at+ksTKdsuztV85K8VOW2j7IzEoDCr01rujsQs1hWGmb tp5vnvY6xTAHpRuHo0Jw4j/8TQWN97XbQbu97O5QOJvFNnojSrRKEqeyNMWXkzDxPg56 w7glAO4Di+lRHxoHUH/feYLvI+FHM3rQcqvRQ5+mwJ9nrQ9UXRG9i5IgmLnq9MdxbKYU dBct/RHU0JesR63MiD2rUhGuLX5KE9BURQC8gUJObBkvxjDTKRq3iAn2gVOXfAcUmtOh tOIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bQGwIxIB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p10si466188pgi.549.2018.12.06.07.59.54; Thu, 06 Dec 2018 07:59:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bQGwIxIB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726323AbeLFP7y (ORCPT + 31 others); Thu, 6 Dec 2018 10:59:54 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:35747 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbeLFP7u (ORCPT ); Thu, 6 Dec 2018 10:59:50 -0500 Received: by mail-wm1-f68.google.com with SMTP id c126so1594601wmh.0 for ; Thu, 06 Dec 2018 07:59:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YAJ/pSqxHadg9FAalxrP9XtBWK91iIUrnuOMWYKHTIQ=; b=bQGwIxIBK0/KWy1ZsHZsbFC0w94wP01OxLh+vtw1bAeRhFTgOQJAMWKaoVcaUF7cZl lusOfufP8vuz4RrpEz6ugIwqp3RJ182W4P7mOp69ecMwFaYMJrPN5UzI1ZK73k+sd659 MvVrQK0ljOjwxFk4GJiWJRA/VvjgBOWLtupSg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YAJ/pSqxHadg9FAalxrP9XtBWK91iIUrnuOMWYKHTIQ=; b=jHhcVDDX+SRXIU/Vw/LJuwEmss1ebp0RD+pgpHGUdNLg5b8iAS6fypJCVOCMFnFye6 B/f7U0uXN2nYJtmFG+DwE1HfKlwDkCtjWmvbz7NyDv9xPHPmSBCNaRSvR4HwLpQF23fF g7Ihormz1DxWdPBauglbywZ4FVx3Via1b8T8lFPfC1uvAJd29zeNXgJRHIh7jle0mIHT R4+tcRLiJ9Suv/cbi1pJ6++rmwKfgcf2dFpPHTGVMNkPLQBQYdTmanRSQDmEz2LRj6gs JGiw2y9XYH8SO7M6u0Aj/xDjC6w/Pg5HFkgquizfx4Re3uQLSNNG/lTrDFiQZYVQCfQF zkDQ== X-Gm-Message-State: AA+aEWbzwJf5lB0gUjJ2HOVstY2LIg2xk/b68NT037ieH1kUlWokN+a0 FJRWAfDOkYQeoz3y5GMDZ/+dlidHjEn9/Q== X-Received: by 2002:a1c:770c:: with SMTP id t12mr20471294wmi.101.1544111987884; Thu, 06 Dec 2018 07:59:47 -0800 (PST) Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) by smtp.gmail.com with ESMTPSA id y34sm1525233wrd.68.2018.12.06.07.59.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 07:59:47 -0800 (PST) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Robin Murphy , Will Deacon , Catalin Marinas , Marc Zyngier , Suzuki Poulose , Dave Martin Subject: [PATCH 5/5] arm64/mm: use string comparisons in dcache_by_line_op Date: Thu, 6 Dec 2018 16:57:39 +0100 Message-Id: <20181206155739.20229-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181206155739.20229-1-ard.biesheuvel@linaro.org> References: <20181206155739.20229-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The GAS directives that are currently being used in dcache_by_line_op rely on assembler behavior that is not documented, and probably not guaranteed to produce the correct behavior going forward. Currently, we end up with some undefined symbols in cache.o: $ nm arch/arm64/mm/cache.o ... U civac ... U cvac U cvap U cvau This is due to the fact that the comparisons used to select the operation type in the dcache_by_line_op macro are comparing symbols not strings, and even though it seems that GAS is doing the right thing here (undefined symbols by the same name are equal to each other), it seems unwise to rely on this. So let's switch to conditional directives that are documented as operating on strings. Since these cannot be combined like ordinary arithmetic expressions, invert the comparison logic. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/assembler.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.19.2 diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 09c5a5452f60..df3043e76e6a 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -383,21 +383,23 @@ alternative_endif sub \tmp2, \tmp1, #1 bic \kaddr, \kaddr, \tmp2 9998: - .if (\op == cvau || \op == cvac) + .ifnc \op, civac + .ifnc \op, cvap alternative_if_not ARM64_WORKAROUND_CLEAN_CACHE dc \op, \kaddr alternative_else dc civac, \kaddr alternative_endif - .elseif (\op == cvap) + .else alternative_cb arm64_handle_dc_cvap dc civac, \kaddr alternative_cb_alt sys 3, c7, c12, 1, \kaddr // dc cvap dc cvac, \kaddr alternative_cb_end + .endif .else - dc \op, \kaddr + dc civac, \kaddr .endif add \kaddr, \kaddr, \tmp1 cmp \kaddr, \size