summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2016-02-24 14:42:20 +0900
committerBen Skeggs <bskeggs@redhat.com>2016-03-14 09:53:01 +1000
commit3f7377b88246f0d56b56825e1cc791ef2d9ed9e0 (patch)
tree91ace69c557be97b67e81777e3c68c24c24830c8 /lib
parent347a6e78381c2b7e624ad96604fba60b2b933976 (diff)
downloadnouveau-3f7377b88246f0d56b56825e1cc791ef2d9ed9e0.tar.gz
core: add support for secure boot
On GM200 and later GPUs, firmware for some essential falcons (notably GR ones) must be authenticated by a NVIDIA-produced signature and loaded by a high-secure falcon in order to be able to access privileged registers, in a process known as Secure Boot. Secure Boot requires building a binary blob containing the firmwares and signatures of the falcons to be loaded. This blob is then given to a high-secure falcon running a signed loader firmware that copies the blob into a write-protected region, checks that the signatures are valid, and finally loads the verified firmware into the managed falcons and switches them to privileged mode. This patch adds infrastructure code to support this process on chips that require it. v2: - The IRQ mask of the PMU falcon was left - replace it with the proper irq_mask variable. - The falcon reset procedure expecting a falcon in an initialized state, which was accidentally provided by the PMU subdev. Make sure that secboot can manage the falcon on its own. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/include/nvif/os.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/include/nvif/os.h b/lib/include/nvif/os.h
index 85c958881..fbde224ba 100644
--- a/lib/include/nvif/os.h
+++ b/lib/include/nvif/os.h
@@ -233,7 +233,7 @@ hweight32(u32 v) {
#define BITMAP_BIT(b) ((b) % BITS_PER_LONG)
static inline int
-test_bit(int bit, volatile unsigned long *ptr)
+test_bit(int bit, const volatile unsigned long *ptr)
{
return !!(ptr[BITMAP_POS(bit)] & (1UL << BITMAP_BIT(bit)));
}
@@ -285,6 +285,17 @@ __set_bit(long bit, volatile unsigned long *addr)
}
static inline long
+find_next_bit(const volatile unsigned long *addr, int bits, int bit)
+{
+ while (bit < bits) {
+ if (test_bit(bit, addr))
+ break;
+ bit++;
+ }
+ return bit;
+}
+
+static inline long
find_first_zero_bit(volatile unsigned long *addr, int bits)
{
int bit;
@@ -310,6 +321,10 @@ bitmap_clear(unsigned long *addr, unsigned int pos, unsigned int bits)
__clear_bit(pos++, addr);
}
+#define for_each_set_bit(bit, addr, size) \
+ for ((bit) = find_next_bit((addr), (size), 0); (bit) < (size); \
+ (bit) = find_next_bit((addr), (size), (bit) + 1))
+
/******************************************************************************
* atomics
*****************************************************************************/