From patchwork Wed Oct 7 07:26:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ching Huang X-Patchwork-Id: 268404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C04FBC4363C for ; Wed, 7 Oct 2020 07:26:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 617D220870 for ; Wed, 7 Oct 2020 07:26:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=areca-com-tw.20150623.gappssmtp.com header.i=@areca-com-tw.20150623.gappssmtp.com header.b="oxZ9aBBp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727635AbgJGH0y (ORCPT ); Wed, 7 Oct 2020 03:26:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726771AbgJGH0x (ORCPT ); Wed, 7 Oct 2020 03:26:53 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8004C0613D2 for ; Wed, 7 Oct 2020 00:26:53 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id a1so618141pjd.1 for ; Wed, 07 Oct 2020 00:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=areca-com-tw.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=FPB7OOQl4IYhU+HU218GOVBRq9NfyKJiihhmcpJ2Hao=; b=oxZ9aBBpkvOvdgr2CrqMxbh+tb9oWDoEjkUWOAV7zx1x45otIdu0jTGj6y6nkL9WfS 83ncVldNuP0AIzasgpAL+hE8845xe6QEViCK5skmnbfjgNKKJtLikVLMaRix0RT4L/Hb Rpgmrcn23wZnkmsolZ5xRGGEc5PyosU1awEHsTwHrDUSxKR9zRV6VPVAp1QpaFwtJEbg v1fiA1kn21yUceRFI3MQkAvxIiTafFcxx32ICjJ9qlWxd2x8cFZnjuBT4obe/P2mrA+r KUUSZ1LURs7GGAvF6yaE1zNfMwIViXeeSpK8qS2NYX+4qy7v8lNDF/h2MPTySi+u0LQF 9iGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=FPB7OOQl4IYhU+HU218GOVBRq9NfyKJiihhmcpJ2Hao=; b=gjGttESLGRdPtE068mK717pqjVq8Viu55lPU3r5xi/qIETWxH78UpAChoH+BHhl339 xpLuQXBiD0Rny//GjsT47yAQS1M6Myy5SAmyLdFoTzmD7PbLzdtdk5NXNDkomNc46Z/9 pfKFDaGjRWeJJMVDJLGDcoGo98fltgfQHKzwPCVgnrr4c6kyWfQ7en9ICfoUBENYrhGT Iyi7vye7GUiXCd2J3CNID44aCaxWJmxgbdpYjC2r3rRnxl9BzRRq7TYGQ+xv5GuW9qwD NZTeNvUpl+7+XsFLPnUmAsN4UJLVPAzI4zspqfM1NyQHAIToUInZTZMrfmWV/7/FdTz9 zPzw== X-Gm-Message-State: AOAM530VC4kIOGDh4L4DQ9ujYaIG+NY7K87zOdZOvAWV3ftUmK/STHAZ 04DasJOmOjy1vxEoPO5Hfb53Rg== X-Google-Smtp-Source: ABdhPJwAi4sXCxn4b1gEkyDCnbA9nQFAQCJhRdmvlBsdMzYZrTzT1FL5quT1Kgb5UMe2aahzbCj2Ww== X-Received: by 2002:a17:90a:5c83:: with SMTP id r3mr1767359pji.112.1602055613222; Wed, 07 Oct 2020 00:26:53 -0700 (PDT) Received: from centos78 (60-248-88-209.HINET-IP.hinet.net. [60.248.88.209]) by smtp.gmail.com with ESMTPSA id s11sm1844594pgm.36.2020.10.07.00.26.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Oct 2020 00:26:52 -0700 (PDT) Message-ID: <7dc957d8e16d04cb9605bef10e474acc52235190.camel@areca.com.tw> Subject: [PATCH v3 1/2] scsi: arcmsr: Use upper_32_bits() instead of dma_addr_hi32() From: ching Huang To: martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org, Linux Kernel Mailing List Date: Wed, 07 Oct 2020 15:26:52 +0800 X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) Mime-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: ching Huang Use upper_32_bits() instead of dma_addr_hi32(). Signed-off-by: ching Huang diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index d13d672..55d85c9 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -653,9 +653,9 @@ static void arcmsr_hbaF_assign_regAddr(struct AdapterControlBlock *acb) 3) >> 2) << 2; pmuF = acb->pmuF; /* host buffer low address, bit0:1 all buffer active */ - writel((uint32_t)(host_buffer_dma | 1), &pmuF->inbound_msgaddr0); + writel(lower_32_bits(host_buffer_dma | 1), &pmuF->inbound_msgaddr0); /* host buffer high address */ - writel(dma_addr_hi32(host_buffer_dma), &pmuF->inbound_msgaddr1); + writel(upper_32_bits(host_buffer_dma), &pmuF->inbound_msgaddr1); /* set host buffer physical address */ writel(ARCMSR_HBFMU_DOORBELL_SYNC1, &pmuF->iobound_doorbell); } @@ -4057,11 +4057,8 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb) writel(cdb_phyaddr, ®->msgcode_rwbuffer[2]); writel(cdb_phyaddr_hi32, ®->msgcode_rwbuffer[3]); writel(acb->ccbsize, ®->msgcode_rwbuffer[4]); - dma_coherent_handle = acb->dma_coherent_handle2; - cdb_phyaddr = (uint32_t)(dma_coherent_handle & 0xffffffff); - cdb_phyaddr_hi32 = (uint32_t)((dma_coherent_handle >> 16) >> 16); - writel(cdb_phyaddr, ®->msgcode_rwbuffer[5]); - writel(cdb_phyaddr_hi32, ®->msgcode_rwbuffer[6]); + writel(lower_32_bits(acb->dma_coherent_handle2), ®->msgcode_rwbuffer[5]); + writel(upper_32_bits(acb->dma_coherent_handle2), ®->msgcode_rwbuffer[6]); writel(acb->ioqueue_size, ®->msgcode_rwbuffer[7]); writel(ARCMSR_INBOUND_MESG0_SET_CONFIG, ®->inbound_msgaddr0); acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; @@ -4081,11 +4078,8 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb) acb->msgcode_rwbuffer[2] = cdb_phyaddr; acb->msgcode_rwbuffer[3] = cdb_phyaddr_hi32; acb->msgcode_rwbuffer[4] = acb->ccbsize; - dma_coherent_handle = acb->dma_coherent_handle2; - cdb_phyaddr = (uint32_t)dma_coherent_handle; - cdb_phyaddr_hi32 = dma_addr_hi32(dma_coherent_handle); - acb->msgcode_rwbuffer[5] = cdb_phyaddr; - acb->msgcode_rwbuffer[6] = cdb_phyaddr_hi32; + acb->msgcode_rwbuffer[5] = lower_32_bits(acb->dma_coherent_handle2); + acb->msgcode_rwbuffer[6] = upper_32_bits(acb->dma_coherent_handle2); acb->msgcode_rwbuffer[7] = acb->completeQ_size; writel(ARCMSR_INBOUND_MESG0_SET_CONFIG, ®->inbound_msgaddr0); acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; From patchwork Wed Oct 7 07:31:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ching Huang X-Patchwork-Id: 287238 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5412BC4363C for ; Wed, 7 Oct 2020 07:31:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D58DB207EA for ; Wed, 7 Oct 2020 07:31:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=areca-com-tw.20150623.gappssmtp.com header.i=@areca-com-tw.20150623.gappssmtp.com header.b="xys4W4yp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727717AbgJGHbr (ORCPT ); Wed, 7 Oct 2020 03:31:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbgJGHbr (ORCPT ); Wed, 7 Oct 2020 03:31:47 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC467C061755 for ; Wed, 7 Oct 2020 00:31:45 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id 22so837364pgv.6 for ; Wed, 07 Oct 2020 00:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=areca-com-tw.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=6hV7PJClGfgaN5TCcjKdtC8dZqi0TjTnFZSL7SHtRuk=; b=xys4W4ypmtRSJhPuvzq7s7axuVnaIiwpBUAUfnpo3KP7OiUS7EPpweAu0+QNIy7gz/ m92F1Mns/2D+LivzbQ2pD7lHWvB/JlX+EF0I2p45tDKi+friRCqi0MIjWrVC+808yT3t kHPVF5iCy9mdBMqHcbawN7bJVWaE7KaMxDxEiVMUXRxh1UVwYS+jInOLOPm5bOt19K02 nY5JJxDFJGHStYdVzRLX9mlwU/NY+QwLjVMxzdObGqnz2RgKHtBlffpiTHquToIFrAov dedhuUoSNf6n6/Bip5VawgAr8tjh9ORsGVM3Ka3ZPHXZlYcnDOHcfI7ejuh9IaAq+3tA pvqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=6hV7PJClGfgaN5TCcjKdtC8dZqi0TjTnFZSL7SHtRuk=; b=AF7nCuWSW6eBmpYHd+EdkQFmxKU+IIwCVLPTwOcW+qIu9DSpF/RF/knumY2GE08azv PLO1vfPDTMBltH2DKB7duKBY1Z0RP2XeVkO9Sd4fpyyfk0+322HM5dCoTQtT4FRLN8bX sv7nofoukrlLxwtwWu+ougtS5fUjvNN40UYrPABjS1rz2IZsM+XBDKq2wT3rZQtyLk1i 73Cp9F0e8NdpGlA8Dc2R6p5jy+uRrXGWjqiwt8904y0mGjYPgBmC9KBqdWV88g6Lv/jP 13fn5EkLByffEmYsPL/f80tldMDNwgUhW0ggQsI3tmf1rSotB2u3tvpS8mmJVCJDtG+m CErw== X-Gm-Message-State: AOAM532wfxLm+DmIHsc8mSQFPgngUr4322ioahv0vXj0aKXg8K2LsQwo G4ahJJUZMzXWVPL805sNhflsUw== X-Google-Smtp-Source: ABdhPJzkvpBvMcshEG/PBntDPZnKQ0S/7L3SIzNxi8KvQ81B4ZFVi+qGVidyehgCG3ndaMOz6HyKpQ== X-Received: by 2002:a63:5663:: with SMTP id g35mr1917905pgm.163.1602055905370; Wed, 07 Oct 2020 00:31:45 -0700 (PDT) Received: from centos78 (60-248-88-209.HINET-IP.hinet.net. [60.248.88.209]) by smtp.gmail.com with ESMTPSA id o17sm1224263pji.30.2020.10.07.00.31.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Oct 2020 00:31:44 -0700 (PDT) Message-ID: Subject: [PATCH v3 2/2] scsi: arcmsr: use round_up() instead of logical operation From: ching Huang To: martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org, Linux Kernel Mailing List Date: Wed, 07 Oct 2020 15:31:44 +0800 X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) Mime-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: ching Huang Use round_up() instead of logical operation. Reported-by: Martin K. Petersen Signed-off-by: ching Huang diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 55d85c9..1e358d9 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -644,13 +644,12 @@ static void arcmsr_hbaF_assign_regAddr(struct AdapterControlBlock *acb) struct MessageUnit_F __iomem *pmuF; memset(acb->dma_coherent2, 0xff, acb->completeQ_size); - acb->message_wbuffer = (uint32_t *)((((unsigned long)acb->dma_coherent2 + - acb->completeQ_size + 3) >> 2) << 2); + acb->message_wbuffer = (uint32_t *)round_up((unsigned long)acb->dma_coherent2 + + acb->completeQ_size, 4); acb->message_rbuffer = ((void *)acb->message_wbuffer) + 0x100; acb->msgcode_rwbuffer = ((void *)acb->message_wbuffer) + 0x200; memset((void *)acb->message_wbuffer, 0, MESG_RW_BUFFER_SIZE); - host_buffer_dma = ((acb->dma_coherent_handle2 + acb->completeQ_size + - 3) >> 2) << 2; + host_buffer_dma = round_up(acb->dma_coherent_handle2 + acb->completeQ_size, 4); pmuF = acb->pmuF; /* host buffer low address, bit0:1 all buffer active */ writel(lower_32_bits(host_buffer_dma | 1), &pmuF->inbound_msgaddr0);