From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 535DDA054F; Mon, 15 Mar 2021 11:19:50 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 15CE824260B; Mon, 15 Mar 2021 11:19:50 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mails.dpdk.org (Postfix) with ESMTP id 014544003C for ; Mon, 15 Mar 2021 11:19:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615803588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1s8GV9Kjjb6aiXX323qLMHrIm/87QnTpn+o4MRzO5Ns=; b=g11wTT0J8V5xHUiHk2sM605M3LfMoim3hlNoabRzEk7MlI2AuY9Cso/0BObCpN5+DQzL5h O50vKyigpl2TjVtB6Z1NVmlDxSRjd77OdvHcI+huTxKzjovvnksi4D2l73XjI5QxKidKkO uQN5KHKpgoDjEfmX5jZjfyNu8OVm3sc= Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-516-IbouyD_4PMWbqXLVxKTslA-1; Mon, 15 Mar 2021 06:19:46 -0400 X-MC-Unique: IbouyD_4PMWbqXLVxKTslA-1 Received: by mail-vs1-f71.google.com with SMTP id s85so8406260vsc.8 for ; Mon, 15 Mar 2021 03:19:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1s8GV9Kjjb6aiXX323qLMHrIm/87QnTpn+o4MRzO5Ns=; b=MPfmlSNp/Ac3sehq3e3Qggn4+BQfsbcRvvmpykstzjbTtrRFwDc684nAx8vL4pzj0L uFZ0V1YFFx6EpkjHKQfw6VXIBhTv0tTjHE10bDf5UgFMaDFR4dgRCPU+Z7GMlBYLY8So ZJNmzRRn6Q1eelTp7/FmlBJ/Xnj3wk6Bcd5ORDeo7pR2RDML6NYFhSFFDcCsHtydULvK PIfy6LwRnrGiuyh3np8otoC4mvgsKJqB7UQlYIiOtVYs/ZZQVMmwilg44YdJagiQSeoM TfQhmkJymIJmbE/Zfm2P1kvPKXsttdjMxkGNf+QFjYuksOeEw883Smr5kppbElhKeBgi efOw== X-Gm-Message-State: AOAM5336LQRi4r/RHBfnYzdBZ/kfjYTqst+eURdthzQ0lGL8WFm03qDl UbVrJaFM4KOxeStftGFN3crfcP1QnHhtSjqkAnk4eYyc5r4gzNerLoq55brYo7LP+I67Skr0rNv DWpG502l4I+Qe97zxaW4= X-Received: by 2002:ab0:21d1:: with SMTP id u17mr2039278uan.126.1615803586242; Mon, 15 Mar 2021 03:19:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfSdeAOpcFie5R5rkbDhpg8qld1YeIVQn6vphc7812a3c3VaO9jrqXA4rk3rlje++omOo7GWk5h/Vlr15t3+w= X-Received: by 2002:ab0:21d1:: with SMTP id u17mr2039273uan.126.1615803586028; Mon, 15 Mar 2021 03:19:46 -0700 (PDT) MIME-Version: 1.0 References: <1614797225-114594-1-git-send-email-huawei.xhw@alibaba-inc.com> <1615397790-16169-1-git-send-email-huawei.xhw@alibaba-inc.com> <1615397790-16169-3-git-send-email-huawei.xhw@alibaba-inc.com> In-Reply-To: From: David Marchand Date: Mon, 15 Mar 2021 11:19:35 +0100 Message-ID: To: "Wang, Haiyue" , =?UTF-8?B?6LCi5Y2O5LyfKOatpOaXtuatpOWIu++8iQ==?= Cc: "maxime.coquelin@redhat.com" , "Yigit, Ferruh" , "dev@dpdk.org" , "Burakov, Anatoly" , "xuemingl@nvidia.com" , "grive@u256.net" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v11 2/2] bus/pci: support MMIO in PCI ioport accessors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Mar 11, 2021 at 7:43 AM Wang, Haiyue wrote: > Like kernel use macro to do pio and mmio, maybe we can also to do so for > making code clean: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/iomap.c > > #define IO_COND(addr, is_pio, is_mmio) do { \ > unsigned long port = (unsigned long __force)addr; \ > if (port >= PIO_RESERVED) { \ > is_mmio; \ > } else if (port > PIO_OFFSET) { \ > port &= PIO_MASK; \ > is_pio; \ > } else \ > bad_io_access(port, #is_pio ); \ > } while (0) > > > Like: > > #if defined(RTE_ARCH_X86) > #define IO_COND(addr, is_pio, is_mmio) do { \ > if ((uint64_t)(uintptr_t)addr >= PIO_MAX) { \ > is_mmio; \ > } else { \ > is_pio; \ > } \ > } while (0) > #else > #define IO_COND(addr, is_pio, is_mmio) do { \ > is_mmio; \ > } while (0) > #endif We should not just copy/paste kernel code. Plus here, this seems a bit overkill. And there are other parts in this code that could use some polishing. What do you think of merging this series as is (now that we got non regression reports) and doing such cleanups in followup patches? -- David Marchand