Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3649532ybf; Tue, 3 Mar 2020 09:46:39 -0800 (PST) X-Google-Smtp-Source: ADFU+vtWulGcXKMNsJ7j/bu3sSTNCv2XjDTh9PtHxBNTNCIw8vOICnxYbHU50s7ywZEcYGkp7ayI X-Received: by 2002:a05:6830:18ce:: with SMTP id v14mr4141998ote.36.1583257599034; Tue, 03 Mar 2020 09:46:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583257599; cv=none; d=google.com; s=arc-20160816; b=O7vGg/Lb1H2Lzu7zx2Ky9LVgvMcqshEUb34xqI5I28Xtd8m0zBgbRrRUzn3YoEfZU0 66ORrYCZdm5euJwpZ7AsymMjHqS8/sg21od7pW51z061k0DJ3rRv3KGWxLzleolPNBeS +CqxiUIhO8N8xIEftr5+diYEcK9FfIzqAi0LXekagXOgNpKgB+9jswKcPtLm9ZqW25LW 8hBKvRYaVwpYs7UqipCpfzb8OP9mHHMaWRQcOE5l9sKuW35Np2F7muNzbpTsaNlX7cYi e/eO5nhg7890O5Pr/tQvJn1WD8n1i0eYRfu/lMjfnlidpossk63+q+Kf/fHvoocOz05h 84lA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=xKJ6ZTmDbB7scAfhkWRD3g97OJClchNKaw3GCPCqs1w=; b=eFmotJKILvA/xrBUk9y5cxNKoWf5EvMiJG9TfW/TSOdlbue1mkNLSDQgKNaVPKY6mQ kf0/MqzFX19/p/ZDsQEXLKsd0K4nDgGaCjKkeGdsrZ6PyrI8z12TDkow6xpyilHiqEhL sfVeM2z7qTsjBzXaShGV7P+vFo+QCu8c4wHpexS+WJ9PHfQhjFre+vGhV48kFs0wBKVD nFPUNqBmEsA/nvEm8eFwnjWoanMkkrtl73bnWXXpnk06PxinD37LmtguvBj0bxxMBdBP 0FUczqAtj2MThrE+glsGZKDvJs8aHM4+l+yc/1oQz5N+sGs8Q6X3Aw8l7TWo2yEdarAw ppuQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s188si7731830oia.277.2020.03.03.09.46.16; Tue, 03 Mar 2020 09:46:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729664AbgCCRQW (ORCPT + 99 others); Tue, 3 Mar 2020 12:16:22 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:2506 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729100AbgCCRQW (ORCPT ); Tue, 3 Mar 2020 12:16:22 -0500 Received: from lhreml709-cah.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id 20BACB3F076F71A9F686; Tue, 3 Mar 2020 17:16:20 +0000 (GMT) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by lhreml709-cah.china.huawei.com (10.201.108.32) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 3 Mar 2020 17:16:19 +0000 Received: from [127.0.0.1] (10.202.226.45) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 3 Mar 2020 17:16:19 +0000 Subject: Re: About commit "io: change inX() to have their own IO barrier overrides" To: Arnd Bergmann CC: Sinan Kaya , "xuwei (O)" , "Bjorn Helgaas" , "linux-kernel@vger.kernel.org" , Jiaxun Yang , linux-arch , Linux ARM , Will Deacon , Catalin Marinas References: <2e80d7bc-32a0-cc40-00a9-8a383a1966c2@huawei.com> <8207cd51-5b94-2f15-de9f-d85c9c385bca@huawei.com> <6115fa56-a471-1e9f-edbb-e643fa4e7e11@kernel.org> <7c955142-1fcb-d99e-69e4-1e0d3d9eb8c3@huawei.com> From: John Garry Message-ID: <773c5d63-5626-ca3d-634b-73d3a7776ddb@huawei.com> Date: Tue, 3 Mar 2020 17:16:18 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.45] X-ClientProxiedBy: lhreml725-chm.china.huawei.com (10.201.108.76) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/03/2020 16:40, Arnd Bergmann wrote: > On Tue, Mar 3, 2020 at 2:18 PM John Garry wrote: >> >> + linux-arch >> >> For background, see >> https://lore.kernel.org/lkml/2e80d7bc-32a0-cc40-00a9-8a383a1966c2@huawei.com/ >> >>>> >>>> So today only ARM64 uses it for this relevant code, above. But maybe >>>> others in future will want to use it - any arch without native IO port >>>> access is a candidate. >>> >>> I'm looking at Arnd here for help. >>> >>>> >>>>> >>>>> As long as the expectations are set, I see no reason why it shouldn't >>>>> but, I'll let Arnd comment on it too. >>>> >>>> ok, so it looks reasonable consider replicating your change for ***, above. >> >> To be clear, I would make this change in lib/logic_pio.c since >> __io_pbr() can be overridden per-arch: >> >> #define BUILD_LOGIC_IO(bw, type) >> type logic_in##bw(unsigned long addr) >> { >> type ret = (type)~0; >> if (addr < MMIO_UPPER_LIMIT) { >> - ret = read##bw(PCI_IOBASE + addr); >> + __io_pbr(); >> + ret = __raw_read##bw(PCI_IOBASE + addr); >> + __io_pbr(); > > __io_par(); > >> } else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { >> struct logic_pio_hwaddr *entry = find_io_range(addr); >> >> ... >> >> (forgetting leX_to_cpu for the moment) > > Yes, I suppose this is required to get consistent behavior on arm64, > which overrides __io_par() but not __io_ar(), with the current code > the barrier after read is weaker when LOGIC_PIO is enabled than it > is otherwise. Ok. Apart from that, this code is somewhat hidden. I mean, most people would consider generic IO port accessors come from asm-generic/io.h only, which is not the case here. Maybe this can be better integrated into asm-generic/io.h, the only hint today being the logic_pio.h include half way through the file. > > For other architectures, I suppose we would need another indirection > level, as those can also override the default inb() itself to do something > other than readb(PCI_IOBASE + addr), and that is not handled > here either. We can do that if we need LOGIC_PIO on a second > architecture. Jiaxun Yang did mention that MIPS may want to move away from its own IO space management. Thanks, John