Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3503899ybi; Tue, 18 Jun 2019 01:45:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxM1xygBDfLlLFr1Zvo08IG5WVk1pvqjROZlBKmBVtFpHlwZUcnnpimtXb+h0gq4Yc3hpfE X-Received: by 2002:a63:1462:: with SMTP id 34mr1642511pgu.417.1560847537389; Tue, 18 Jun 2019 01:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560847537; cv=none; d=google.com; s=arc-20160816; b=1FBML2URts7/j5MWHTBpLBQrYHJHoqXkG9DZ9WJlxxhW+wnPlnMQp1beGtG71GwjEw Xj2EWBfZMVUZXEGSJIVGQUD/lzOTbRfT8Z5HAGDLtKvn0wL+142VjQxX2K+GuxXEPgKJ m99YlQ8WdYYazB7b3T4V3uGsR0uToie8nf8dMovAoHv1uZBG8TnVFt/3Voj5lQsmayW1 iI9erYNnH+XMXqI+N+U73o2S3+yx/h3qK9XVmPp0lKfH/2S6woSVsUqLNiSOCqkHqMd/ wvhk64LFa3ykxUqaNz3xyfwW1F4WD7lvvapuXRgpbh9UV49/9QtFNGQgxM9mlVmupsod Ylrw== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=m3Akq+Jq2fpkm7AfHlvsMlAHLGrKnHqxx5j45RXcyAw=; b=k6eqMClGcc6MssKnXZPP7L3OAUDVL8wFkfTMNwfQK64hsYbU9jRPhtIJ2yBmqM4qwl c0rJfrt1rP4nKjrOJ3H09aSMXE5tGOF1BMHPhZXbwQu8xv2TonWklXdXRABFGDL0xwlt 7DUYcPlWWUMvyU6J9EEKi2hjL5/poGq/vIucvQhSrYlhY0nWnJpLKclg/R2IDctTxCB9 wnLM6zEoZ29qOD4DHho03b6OXsbOxPSUaMj4Ncv1SEAoWS7F7oYKvaKVJGwApbr/qMvY rn+dCjYKql5R0get7PzPQPPv6kvQU+xYxlNvrmptfu1T5uVJxsw8B42ZZbOkPODqm3o/ N74g== 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 f192si2431201pgc.77.2019.06.18.01.45.21; Tue, 18 Jun 2019 01:45:37 -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; 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 S1729253AbfFRIok (ORCPT + 99 others); Tue, 18 Jun 2019 04:44:40 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:45356 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729180AbfFRIok (ORCPT ); Tue, 18 Jun 2019 04:44:40 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 740B877E6ECFBD1401EE; Tue, 18 Jun 2019 16:44:38 +0800 (CST) Received: from [127.0.0.1] (10.202.227.238) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Tue, 18 Jun 2019 16:44:30 +0800 Subject: Re: [PATCH v2] bus: hisi_lpc: Don't use devm_kzalloc() to allocate logical PIO range To: Bjorn Helgaas References: <1560507893-42553-1-git-send-email-john.garry@huawei.com> <82840955-6365-0b95-6d69-8a2f7c7880af@huawei.com> <9e8b6971-3189-9d4b-de9a-ff09f859f4f6@huawei.com> CC: , , , "Linux Kernel Mailing List" , Joe Perches From: John Garry Message-ID: <539835d3-770c-285c-0c49-ae15ceaa3079@huawei.com> Date: Tue, 18 Jun 2019 09:44:26 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.238] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> - zhichang personal mail >> It's now on my todo list. >> >> I'll need advice on how to test this for hot-pluggable host bridges. >> >>> >>> Could you just move the logic_pio_register_range() call farther down >>> in hisi_lpc_probe()? IIUC, once logic_pio_register_range() returns, >>> an inb() with the right port number will try to access that port, so >>> we should be prepared for that, i.e., maybe this in the wrong order to >>> begin with? >> >> No, unfortunately we can't. The reason is that we need the logical PIO >> base for that range before we enumerate the children of that host. We >> need that base address for "translating" the child bus addresses to >> logical PIO addresses. > Hi Bjorn, > Ah, yeah, that makes sense. I think. We do assume that we know all > the MMIO and I/O port translations before enumerating devices. It's > *conceivable* that could be changed someday since we don't actually > need the translations until a driver claims the device, We actually need them before a driver claims the device. The reason is that when we create that child platform device we set the device's IORESOURCE_IO resources according to the translated logic PIO addresses, and not the host bus address. This is what makes the host transparent to the child device driver. and it would > gain some flexibility if we didn't have to program the host bridge > windows until we know how much space is required. But I don't see > that happening anytime soon. > > Bjorn > > . > BTW, as you may have noticed, in v3 I said I would drop this patch and fix it all properly. My problem is that I need to ensure that the new logical PIO unregister function works ok for hot-pluggable host bridges. I need to get some way to test this. Advice? Thanks, John