Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp596286ybi; Thu, 13 Jun 2019 23:36:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqybvVep1KKaHsbHI5pmXVJUyCXHrN9rBx/m0i6xx+y4mubMboxVbKEBL7llckbuVFTg78f+ X-Received: by 2002:a17:902:b487:: with SMTP id y7mr31421520plr.219.1560494202981; Thu, 13 Jun 2019 23:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560494202; cv=none; d=google.com; s=arc-20160816; b=btrN7nmXFc9Vbpj/5kRLmmScFm57ltpuMPIJm0iX35jB0/R6PaIBAAYzCoqHe/uwUo t1LKhmhIZRQPfKzXbuMZso0Vc0zsQlZHBnRSbFqGko1tyCjEimMw1JIUskT8RhNdcY8W odLz5viVOqPNFRZb4tq84NQTiiUd7POlgMUFek5n2LEoCex/5uGRdIPDZ8EMEb8bX9Df A/ZVcNsjZ32+8J3WVIY7bJiEXi7+dzclfdUkyBo71zw94B8rLRyqsKlvyQ6tI9FAxCUC +RE+zFkA5vpQ/e/iqNtuUUSvZY74vpBssl67VCpQ6xPCXrf2U0UvCKhdjRvpZ4BS5Qf1 loNw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=2MEVIt+PlMUB27yCjfj/2xmvsTwKURfuQtH2qPYNxsw=; b=hGVABbfwd635V0vxxYXfhZgaqmoCb8DN4VKBBhHZCNlzeLLOyZCNoLEiInNrTMJm27 oyZrttrevpdsuHPGc40PiSDu/T9IM+V39/ktHk4mcGjzC6yrlYWHg48m+RJTrkwyl+r3 CffHFRa9UafyZs8zBpnA3hHvun0VhNcIwEcJhKxRBwwac0zDK8lrz2nXNIY4MsCKobt0 S4R1ihjtK42dBG0+2d4UEH0oF4dRuoI+pwY7F6xJQ5qNXlWxfeIDERz3fZsZd6j4k0RZ iRYbaBnZBfa8mpBQEE8KIGQxzqX7zgqpHlRvVectERVGIa8VTBqDfvUBG7jQviOK7YlW KC3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IJ0JOvSs; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si1422596plv.26.2019.06.13.23.36.27; Thu, 13 Jun 2019 23:36:42 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=IJ0JOvSs; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725837AbfFNGgP (ORCPT + 99 others); Fri, 14 Jun 2019 02:36:15 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:43714 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfFNGgP (ORCPT ); Fri, 14 Jun 2019 02:36:15 -0400 Received: by mail-lj1-f194.google.com with SMTP id 16so1156017ljv.10; Thu, 13 Jun 2019 23:36:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2MEVIt+PlMUB27yCjfj/2xmvsTwKURfuQtH2qPYNxsw=; b=IJ0JOvSspzYxd6Ul4Sy7Np9tIWkHfUBiGstx0XJxV5LbgwgM+SUdsahe520SjIR9eP S3K9OWDFjelMsjJC9b7pQNsvVj1FdC82XBfBSfEdOLHhCjS6U7dQCT0s8TNp5Lgwxk6f KWK/E3iKiXjPzUWZ9UEfvjoRCgtgd3z930Ae5mBok/eA2d+dXbm87Oi3El6PG1sJ6Jvs OQA/JCEeAJzyEiRFUUCG4TF1yKPKN/jnLSkWk4zCD6GDsGE/RYOrG5pPDMnHzd7yFm4m JTgDWCTlNgOQCpfofp/znJNLCFSW2itYRui1wza3209BDimAhZeWCUdrzZcuhe1wbbmf nrqQ== 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:mime-version :content-transfer-encoding; bh=2MEVIt+PlMUB27yCjfj/2xmvsTwKURfuQtH2qPYNxsw=; b=RngrHps+aewf+kodDkO6D62paV3a5hfKaUQR1rghJB1FesgylCiwzEgFBqK+LgCBRy hB0sMwp3RvCi3OmBRJH4eArvYMyobPK6H2oQ9ctOm9xPlhSbTxSEXp7GACWhc2KK6EJv zFv3BtCU2/HDuBkEnuB6VU6iKqe3BGEc39cW2wCcMiLBCwu/CRsPvGAI0weZcFEtFuxS xB6mpUK2smS5OwlteCaFnd8EdYDAPjyAPHTl9sDxyLOEVOnwA01rYXEuIFTs2AQ7LYg7 5VaMDIHrIlLKXRFGqb8BAc4ObuqOK8ncj/rHj1WSuLN+D82oxu13I8c8gYNsnX7/xWpk Z0Fw== X-Gm-Message-State: APjAAAWMBCdXpWuJudxsTjPC8xZrgokrC9Zo84X3pSCbpjJKNvMkflSE 7qKUbiROM2iYr0s4RaGske44DCCR X-Received: by 2002:a2e:81c4:: with SMTP id s4mr38659037ljg.182.1560494173078; Thu, 13 Jun 2019 23:36:13 -0700 (PDT) Received: from localhost.localdomain ([5.164.217.122]) by smtp.gmail.com with ESMTPSA id z12sm318548lfg.67.2019.06.13.23.36.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 23:36:12 -0700 (PDT) From: Serge Semin To: Ralf Baechle , Paul Burton , James Hogan Cc: Serge Semin , Arnd Bergmann , "Vadim V . Vlasov" , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mips: Remove q-accessors from non-64bit platforms Date: Fri, 14 Jun 2019 09:33:42 +0300 Message-Id: <20190614063341.1672-1-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are some generic drivers in the kernel, which make use of the q-accessors or their derivatives. While at current asm/io.h the accessors are defined, their implementation is only applicable either for 64bit systems, or for systems with cpu_has_64bits flag set. Obviously there are MIPS systems which are neither of these, but still need to have those drivers supported. In this case the solution is to define some generic versions of the q-accessors, but with a limitation to be non-atomic. Such accessors are defined in the io-64-nonatomic-{hi-lo,lo-hi}.h file. The drivers which utilize the q-suffixed IO-methods are supposed to include the header file, so in case if these accessors aren't defined for the platform, the generic non-atomic versions are utilized. Currently the MIPS-specific asm/io.h file provides the q-accessors for any MIPS system even for ones, which in fact don't support them and raise BUG() in case if any of them is called. Due to this the generic versions of the accessors are never used while an attempt to call the IO-methods causes the kernel BUG(). In order to fix this we need to define the q-accessors only for the MIPS systems, which actually support them, and don't define them otherwise, so to let the corresponding drivers to use the non-atomic q-suffixed accessors. Signed-off-by: Serge Semin Suggested-by: Arnd Bergmann Cc: Vadim V. Vlasov --- arch/mips/include/asm/io.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 29997e42480e..4597017f147b 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -462,7 +462,12 @@ __BUILD_MEMORY_PFX(, bwlq, type, 0) BUILDIO_MEM(b, u8) BUILDIO_MEM(w, u16) BUILDIO_MEM(l, u32) +#ifdef CONFIG_64BIT BUILDIO_MEM(q, u64) +#else +__BUILD_MEMORY_PFX(__raw_, q, u64, 0) +__BUILD_MEMORY_PFX(__mem_, q, u64, 0) +#endif #define __BUILD_IOPORT_PFX(bus, bwlq, type) \ __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0,) \ @@ -488,12 +493,16 @@ __BUILDIO(q, u64) #define readb_relaxed __relaxed_readb #define readw_relaxed __relaxed_readw #define readl_relaxed __relaxed_readl +#ifdef CONFIG_64BIT #define readq_relaxed __relaxed_readq +#endif #define writeb_relaxed __relaxed_writeb #define writew_relaxed __relaxed_writew #define writel_relaxed __relaxed_writel +#ifdef CONFIG_64BIT #define writeq_relaxed __relaxed_writeq +#endif #define readb_be(addr) \ __raw_readb((__force unsigned *)(addr)) @@ -516,8 +525,10 @@ __BUILDIO(q, u64) /* * Some code tests for these symbols */ +#ifdef CONFIG_64BIT #define readq readq #define writeq writeq +#endif #define __BUILD_MEMORY_STRING(bwlq, type) \ \ -- 2.21.0