Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1115952rwd; Tue, 16 May 2023 12:03:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4O+b54W2GtYTNdMTGY7+sIIEgEKvsQuwXXt9CFrTPow3G6hZrJ4P8BIh+W36eAJqjvhlft X-Received: by 2002:a4a:2a41:0:b0:54c:ab6f:4b4 with SMTP id x1-20020a4a2a41000000b0054cab6f04b4mr10847390oox.1.1684263782536; Tue, 16 May 2023 12:03:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684263782; cv=none; d=google.com; s=arc-20160816; b=tRctgIHrjQM2TPGru1cFULQXkkVjPo8C7eLNNrk15C5k62ZnhQPaGkFY9+JpwrzDO2 B4ecJSer7v8QQ5txA8HJfL4fFMxqquypFP/rPUeQ1T6w4dYd1CQ2L7AOHVSIBB3CkGAS SuAvrPKKg1UYxCaw/sNZqIXXxF/lhw8MZOr4SnjWCa+3zoZ8RZWAlGVsQcy1LV6s/2CK YOs74drkOQyivOc72pNlvte3ekCInbKjnianAb1BvImE7OCZ8hynrvicak+S8IMwrV8c PiM70utebrjgJXDbzYtVs0k+Iw8FhAvP50KB5cjrj5ilqA+24Bnxl4t+nsJlussAZcV/ NVSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=D8hrgFwj/IxmETrWztPLsjH83oYYFMWk/GEnHhUo1CE=; b=IkSOdOB2A9MzYXA6P8zeEVB5GFnk4qhfMUrd00ZhoXUi53ZvS48+5ozm2/ngVyrGVn kudNUHMuHF5V3J1b+CwqqWPiL4EzylaTfcb7aLMVllQoS7mhMWzpEokPqrzNmGfNv7ey 1fAF8k1lXQTlJ0twBQ1VChupMycMfecMIjcr9HA378x6gQeEg6pU2ENJwyZwzSSy3jp8 Z2BG9fb3pFj8l7Zu81TwA7ak/rFPZu4VHMLTmt9dGaXH5rtRGKVuC/lD/5WWw1JnRT2W e6m9rE5xGWJcQl/J58drK8p8MhmDEGPLDJxGMgJpQ3wHagSawDDeRwpEigZJkjiO+EmC 0CHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T31VWISA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p8-20020a4a3c48000000b0054f883202b0si13641201oof.26.2023.05.16.12.02.48; Tue, 16 May 2023 12:03:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T31VWISA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229709AbjEPSvU (ORCPT + 99 others); Tue, 16 May 2023 14:51:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbjEPSvT (ORCPT ); Tue, 16 May 2023 14:51:19 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D9A93FB for ; Tue, 16 May 2023 11:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684263019; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D8hrgFwj/IxmETrWztPLsjH83oYYFMWk/GEnHhUo1CE=; b=T31VWISAhvp0WPt5/BiR/IR9cFpdvfxxw2s9XdGeSXAbBLy3bFexSRj2fEfAzrMBT+BjF/ cStfDcPQ0Q+iaBRpKDgWR4iitROjWK+RG6cS7XnxoZC75MOjrephwn7WLJlQrQSQuiWEyL OGSGcEcxd2VjY2xOaShKiqd6dF1lpJg= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-353-dmvszCxWNZai2IMZ1AE5wg-1; Tue, 16 May 2023 14:50:16 -0400 X-MC-Unique: dmvszCxWNZai2IMZ1AE5wg-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-94a356c74e0so1407172666b.2 for ; Tue, 16 May 2023 11:50:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684263015; x=1686855015; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=D8hrgFwj/IxmETrWztPLsjH83oYYFMWk/GEnHhUo1CE=; b=jVmVIGt2IVe1/Rir3RHxYjT+KhwTn7NjpRYsBihhdM4jx7GAbPwt8puU3r/g2FrSGS eEKC4cDDXG1jMedt4Abe6HZInsLH9tbEXCkym3ByyM3DtmODrAATUTraATlzHweMYFT9 GoCToEoiiX89MbXEZYcXUadmo0oUhBowQKJv9CUcIGePEMsHTTiCWC10s/M/hEDsiZaG xdBYeGeMrX+4XnkEDSOhubr8gSJLpJHrSWMzKJ8IBeHexR2NdNlw41PSkYySr/rYnIuK 3XmQ3ClIrfLwhbsbe6uH7CuUxFO+6RSX+afabDXpNYjzklOvNhFX5MXdpzyZLED1WnoB OGDg== X-Gm-Message-State: AC+VfDy1BNE20I4xweMjDULbGh9/hf6ntwceeFqP36NbaeEx769Xat5o aBNnqRjjmceAJ5twp0MnJtCwrA5uNMJIKxIiCfD7N5lV8TUPcKTNyWZDotXWdtlBWNUCoyjCTcn i7gCs4R4j/WO6ez0jnV/+advE X-Received: by 2002:a17:907:c10:b0:94d:7b6b:fda6 with SMTP id ga16-20020a1709070c1000b0094d7b6bfda6mr36675640ejc.22.1684263015350; Tue, 16 May 2023 11:50:15 -0700 (PDT) X-Received: by 2002:a17:907:c10:b0:94d:7b6b:fda6 with SMTP id ga16-20020a1709070c1000b0094d7b6bfda6mr36675621ejc.22.1684263014834; Tue, 16 May 2023 11:50:14 -0700 (PDT) Received: from ?IPV6:2001:1c00:2a07:3a01:67e5:daf9:cec0:df6? (2001-1c00-2a07-3a01-67e5-daf9-cec0-0df6.cable.dynamic.v6.ziggo.nl. [2001:1c00:2a07:3a01:67e5:daf9:cec0:df6]) by smtp.gmail.com with ESMTPSA id h25-20020a1709070b1900b0094ef923a6ccsm11272105ejl.219.2023.05.16.11.50.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 May 2023 11:50:14 -0700 (PDT) Message-ID: Date: Tue, 16 May 2023 20:50:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: drivers/platform/x86/apple-gmux.c:276:15: sparse: sparse: cast to restricted __be32 Content-Language: en-US To: Orlando Chamberlain Cc: kernel test robot , oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org References: <56f2f65b-150d-3cf6-95f9-2dd8232d2717@redhat.com> From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 5/16/23 13:31, Orlando Chamberlain wrote: > Hi, > >> On 16 May 2023, at 8:27 pm, Hans de Goede wrote: >> >> Hi, >> >>> On 5/16/23 12:16, kernel test robot wrote: >>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master >>> head: f1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6 >>> commit: 0c18184de990e63f708b090bcb9fc6c0fbc427cd platform/x86: apple-gmux: support MMIO gmux on T2 Macs >>> date: 9 weeks ago >>> config: i386-randconfig-s001-20230515 >>> compiler: gcc-11 (Debian 11.3.0-12) 11.3.0 >>> reproduce: >>> # apt-get install sparse >>> # sparse version: v0.6.4-39-gce1a6720-dirty >>> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0c18184de990e63f708b090bcb9fc6c0fbc427cd >>> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git >>> git fetch --no-tags linus master >>> git checkout 0c18184de990e63f708b090bcb9fc6c0fbc427cd >>> # save the config file >>> mkdir build_dir && cp config build_dir/.config >>> make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 olddefconfig >>> make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/platform/x86/ >>> >>> If you fix the issue, kindly add following tag where applicable >>> | Reported-by: kernel test robot >>> | Link: https://lore.kernel.org/oe-kbuild-all/202305161712.5l3f4iI4-lkp@intel.com/ >> >> >> >>> vim +276 drivers/platform/x86/apple-gmux.c >>> >>> 265 >>> 266 static u32 gmux_mmio_read32(struct apple_gmux_data *gmux_data, int port) >>> 267 { >>> 268 u32 val; >>> 269 >>> 270 mutex_lock(&gmux_data->index_lock); >>> 271 gmux_mmio_wait(gmux_data); >>> 272 iowrite8((port & 0xff), gmux_data->iomem_base + GMUX_MMIO_PORT_SELECT); >>> 273 iowrite8(GMUX_MMIO_READ | sizeof(val), >>> 274 gmux_data->iomem_base + GMUX_MMIO_COMMAND_SEND); >>> 275 gmux_mmio_wait(gmux_data); >>>> 276 val = be32_to_cpu(ioread32(gmux_data->iomem_base)); >> >> Ok, so sparse does not like this line. >> >>> 277 mutex_unlock(&gmux_data->index_lock); >>> 278 >>> 279 return val; >>> 280 } >>> 281 >>> 282 static void gmux_mmio_write32(struct apple_gmux_data *gmux_data, int port, >>> 283 u32 val) >>> 284 { >>> 285 mutex_lock(&gmux_data->index_lock); >>>> 286 iowrite32(cpu_to_be32(val), gmux_data->iomem_base); >> >> Nor this line. But this is what we want (convert to/from be32 to CPU >> when reading/writing). >> >> There is iowrite32be() but that always unconditionally swabs >> the byte order independent of the CPU byte-order. >> >> Now this is an x86 driver so always swapping is fine, still >> I wonder if there is a better option here then using >> iowrite32be() and ioread32be() ? > > Thanks for finding those functions. I can't think of anything better unless there's a simple way to change sparse's rules so that it will be happy with code like this. Ok, can you please submit a pathc to switch to iowrite32be() and ioread32be() then (when you have time to work on this) ? Regards, Hans >>> 287 iowrite8(port & 0xff, gmux_data->iomem_base + GMUX_MMIO_PORT_SELECT); >>> 288 iowrite8(GMUX_MMIO_WRITE | sizeof(val), >>> 289 gmux_data->iomem_base + GMUX_MMIO_COMMAND_SEND); >>> 290 gmux_mmio_wait(gmux_data); >>> 291 mutex_unlock(&gmux_data->index_lock); >>> 292 } >>> 293 >>> >> >