linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: benh@au1.ibm.com, Michael Neuling <mikey@neuling.org>,
	Oliver O'Halloran <oohall@gmail.com>,
	linuxppc-dev@lists.ozlabs.org
Cc: Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH 2/2] KVM: PPC: hypervisor large decrementer support
Date: Tue, 07 Jun 2016 23:04:13 +1000	[thread overview]
Message-ID: <1465304653.30446.5.camel@ellerman.id.au> (raw)
In-Reply-To: <1464903967.3078.316.camel@au1.ibm.com>

On Fri, 2016-06-03 at 07:46 +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2016-06-01 at 16:23 +1000, Michael Neuling wrote:
> > FWIW you can use:
> >         andis. reg,reg,(LPCR_LD)@ha
> 
> @h in that case. Probably the same result but technically @ha is for
> arithmetic operations.

In this case it doesn't matter, because LPCR_LD is a single bit constant.

But if bit 15 of your constant happens to be 1, using @ha will mean 1 is added
to the high 16 bits of the value.

eg. if you have:

	#define CONSTANT        0x00208000

        lis     r4,CONSTANT@ha

You get:

	10000118:	21 00 80 3c 	lis     r4,33
	                                           ^
	                                           = 0x21


Documented (sort of) here:

  http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#RELOC-TYPE
  
  #ha(value) denotes the high adjusted value: bits 16 through 31 of the indicated value, compensating for #lo() being treated as a signed number:
  
      #ha(x) = (((x >> 16) + ((x & 0x8000) ? 1 : 0)) & 0xffff)

cheers

  reply	other threads:[~2016-06-07 13:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10  4:57 [PATCH v3 1/2] powerpc/timer - large decrementer support Oliver O'Halloran
2016-05-10  4:57 ` [PATCH v3 2/2] KVM: PPC: hypervisor " Oliver O'Halloran
2016-05-11  5:05 ` [PATCH v3 1/2] powerpc/timer - " Balbir Singh
2016-05-31  6:25 ` Michael Neuling
2016-05-31  7:05   ` oliver
2016-05-31  7:16   ` [PATCH " Oliver O'Halloran
2016-05-31  7:16     ` [PATCH 2/2] KVM: PPC: hypervisor " Oliver O'Halloran
2016-06-01  6:23       ` Michael Neuling
2016-06-02 21:46         ` Benjamin Herrenschmidt
2016-06-07 13:04           ` Michael Ellerman [this message]
2016-06-22  7:30         ` oliver
2016-06-01  5:28     ` [PATCH 1/2] powerpc/timer - " Michael Neuling
2016-06-03  2:01       ` Balbir Singh
  -- strict thread matches above, loose matches on Subject: below --
2016-04-12  4:38 Oliver O'Halloran
2016-04-12  4:38 ` [PATCH 2/2] KVM: PPC: hypervisor " Oliver O'Halloran
2016-04-12  4:53   ` kbuild test robot
2016-04-12  7:35   ` Balbir Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465304653.30446.5.camel@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=benh@au1.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=oohall@gmail.com \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).