Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp547865pxf; Thu, 18 Mar 2021 06:53:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxU35s+kIc0yLm4cb0QV4bMcmx0sDR5U6OI0Xt+WwSZKvh8enUdSCJkFXlrSWnMTX2ecq+0 X-Received: by 2002:a17:906:688:: with SMTP id u8mr40298070ejb.38.1616075606593; Thu, 18 Mar 2021 06:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616075606; cv=none; d=google.com; s=arc-20160816; b=ritzTIuYIFBMsgn3+EnqirLBf1cuO9szvm9TE53ni83JCYsu3xM1DxIAkpivZ3jx1G mCZhlYjcZgeuenhOM9goTGQd6ZE7FiHiWQ01rI12Qz7GqpYiOC56Wn1DEBlWnaov6ENj P1lVG5Rnhh6FqbFeuLfPRjMHJvms99aan6iJyze7xYqYgNyagNBK4adiepuPKRkrVeDI tl2MBeKe8TWHsK+U9fCzzKF4TE4s2ei8hn9GHRXgI8gbUAO+G4SzO9ivkrcHQDjZMt42 f5qSRHhUIreri7KxogFnZ1ZcvhYhUrmhbCA7qYqElcxBCNWZ8WIMq2BpnGo9V6/fdOim e/aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NoHvO3wchc4QiGr0Z8Rd6w2XPY+8jpERYxAd8J28b3U=; b=MkH6javygWU+zIjFS4BjRROAkezMXACVFpa8F4obFJIKNQJH3w6bsExn1R5FrMM8BP q8lkJO3osU9tdbQpn7rFLf1cYp3MTmFGuWS61CzSxRfm+QuBQe9RL1rJj8ZkLJVHC8IX +JuQEO6ViXYgn+37cszOUxc4Qnp/5Q7TCwtjQZ2B+680ajoN8CqXvKBKblNEOmTDQs8O McoukVjXAoQxoL+YjtUhkvjTl48Dwx0WOnxQgtArs4p8HuP7qSgHvlkO4IKMg4Puq3XN YP7K5SA6jeA0bsE2V/Z+NtPbNwl3aD1SR7dIChhGSmnDRxo8dTt/7ThYCPdR9J+b2CX0 n9Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QqD/1ldW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id l3si1292108ejd.203.2021.03.18.06.53.03; Thu, 18 Mar 2021 06:53:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QqD/1ldW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230510AbhCRNwI (ORCPT + 99 others); Thu, 18 Mar 2021 09:52:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbhCRNvr (ORCPT ); Thu, 18 Mar 2021 09:51:47 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 730C9C06174A for ; Thu, 18 Mar 2021 06:51:46 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id b10so2329840iot.4 for ; Thu, 18 Mar 2021 06:51:46 -0700 (PDT) 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=NoHvO3wchc4QiGr0Z8Rd6w2XPY+8jpERYxAd8J28b3U=; b=QqD/1ldW6WboVrXrH1BYwO9uG7UpO7bsH52+MU/5qNlPcr8WrE6f/D62nGtYCyIhTY o8Y700oInS1PhdNwBsW2ZVATuA7+VEcY63//N9O33SBQNBU6oO7gjom63B4MhFWGF1fT wKSVPRJIgBekQ3yQwaOrfBgpx/hFYvZxb+MgfOdaqzrxCIB9wMTdFSIBsANjOEcHDvPZ QNwA5XT0vakADpAVyM1ZOxuRCXRvkx/SZrK5xe9m6BYt/oqGsTVSTpRKNxzWOoWQqRhO GWNxIJJAVI77l7Yack/zJOkIVl95b08xMI5FNPL09cWEbBiSR/Am8VOK9y4lAkTgIC8Y JC1w== 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=NoHvO3wchc4QiGr0Z8Rd6w2XPY+8jpERYxAd8J28b3U=; b=RWu4o5jAspJtAYEpWOmlm80NeSv+xQOknkvuRf3gUWCg4gkaCjnmZsE3glkqjkRwd/ xmOU9rWPe4Y0na8PKNX+Tv1lZaJ5edWsi26VuYHib9S+hkorS1KhwztVvbA58XwpFCgM 0G687km72zzfhequ0SFh0AkFqYUhrNz+JKWM6FgpZ1zknhEoRAzNrROlX0sUEJz7+Dv9 21mDvux5xzMrXxPmzFhx6FG2DPMqGGdit0d426jlBVhKSQxMJJiFu/yrMPbYyDoscD4b oZkzk8b9xjuL1Wu7FXuqKfpq3fLwFSeZXaSocXGrqxaEMVta2oCJ3tMRj20PHrZqPWVb rSeA== X-Gm-Message-State: AOAM533gwEZ/nTe0aSr3N2ienU2t2XJ/eJNRDwsEY1FRJ7QDzALlyjoE EmU1yRUxfGISCu5l+9DV7VgTvw== X-Received: by 2002:a5d:9250:: with SMTP id e16mr10491974iol.27.1616075505890; Thu, 18 Mar 2021 06:51:45 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j20sm1139377ilo.78.2021.03.18.06.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Mar 2021 06:51:45 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: f.fainelli@gmail.com, bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 1/4] net: ipa: fix assumptions about DMA address size Date: Thu, 18 Mar 2021 08:51:38 -0500 Message-Id: <20210318135141.583977-2-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210318135141.583977-1-elder@linaro.org> References: <20210318135141.583977-1-elder@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some build time checks in ipa_table_validate_build() assume that a DMA address is 64 bits wide. That is more restrictive than it has to be. A route or filter table is 64 bits wide no matter what the size of a DMA address is on the AP. The code actually uses a pointer to __le64 to access table entries, and a fixed constant IPA_TABLE_ENTRY_SIZE to describe the size of those entries. Loosen up two checks so they still verify some requirements, but such that they do not assume the size of a DMA address is 64 bits. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_table.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index 7450e27068f19..dd07fe9dd87a3 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -126,13 +126,15 @@ static void ipa_table_validate_build(void) */ BUILD_BUG_ON(ARCH_DMA_MINALIGN % IPA_TABLE_ALIGN); - /* Filter and route tables contain DMA addresses that refer to - * filter or route rules. We use a fixed constant to represent - * the size of either type of table entry. Code in ipa_table_init() - * uses a pointer to __le64 to initialize table entriews. + /* Filter and route tables contain DMA addresses that refer + * to filter or route rules. But the size of a table entry + * is 64 bits regardless of what the size of an AP DMA address + * is. A fixed constant defines the size of an entry, and + * code in ipa_table_init() uses a pointer to __le64 to + * initialize tables. */ - BUILD_BUG_ON(IPA_TABLE_ENTRY_SIZE != sizeof(dma_addr_t)); - BUILD_BUG_ON(sizeof(dma_addr_t) != sizeof(__le64)); + BUILD_BUG_ON(sizeof(dma_addr_t) > IPA_TABLE_ENTRY_SIZE); + BUILD_BUG_ON(sizeof(__le64) != IPA_TABLE_ENTRY_SIZE); /* A "zero rule" is used to represent no filtering or no routing. * It is a 64-bit block of zeroed memory. Code in ipa_table_init() -- 2.27.0