diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-05-15 20:03:54 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-05-15 23:23:02 -0400 |
commit | c7754d465b1feade85b5f1c4492781a30f6652a2 (patch) | |
tree | 9a3b6ccb18983c1ea389377028ca51c8170730ef /arch/sparc64/kernel/entry.S | |
parent | 7b104bcb8e460e45a1aebe3da9b86aacdb4cab12 (diff) |
[SPARC64]: Add hypervisor API negotiation and fix console bugs.
Hypervisor interfaces need to be negotiated in order to use
some API calls reliably. So add a small set of interfaces
to request API versions and query current settings.
This allows us to fix some bugs in the hypervisor console:
1) If we can negotiate API group CORE of at least major 1
minor 1 we can use con_read and con_write which can improve
console performance quite a bit.
2) When we do a console write request, we should hold the
spinlock around the whole request, not a byte at a time.
What would happen is that it's easy for output from
different cpus to get mixed with each other.
3) Use consistent udelay() based polling, udelay(1) each
loop with a limit of 1000 polls to handle stuck hypervisor
console.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/entry.S')
-rw-r--r-- | arch/sparc64/kernel/entry.S | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S index c15a3edcb826..732b77cb71f8 100644 --- a/arch/sparc64/kernel/entry.S +++ b/arch/sparc64/kernel/entry.S | |||
@@ -1843,3 +1843,97 @@ sun4v_cpu_state: | |||
1843 | mov %o1, %o0 | 1843 | mov %o1, %o0 |
1844 | 1: retl | 1844 | 1: retl |
1845 | nop | 1845 | nop |
1846 | |||
1847 | /* %o0: API group number | ||
1848 | * %o1: pointer to unsigned long major number storage | ||
1849 | * %o2: pointer to unsigned long minor number storage | ||
1850 | * | ||
1851 | * returns %o0: status | ||
1852 | */ | ||
1853 | .globl sun4v_get_version | ||
1854 | sun4v_get_version: | ||
1855 | mov HV_CORE_GET_VER, %o5 | ||
1856 | mov %o1, %o3 | ||
1857 | mov %o2, %o4 | ||
1858 | ta HV_CORE_TRAP | ||
1859 | stx %o1, [%o3] | ||
1860 | retl | ||
1861 | stx %o2, [%o4] | ||
1862 | |||
1863 | /* %o0: API group number | ||
1864 | * %o1: desired major number | ||
1865 | * %o2: desired minor number | ||
1866 | * %o3: pointer to unsigned long actual minor number storage | ||
1867 | * | ||
1868 | * returns %o0: status | ||
1869 | */ | ||
1870 | .globl sun4v_set_version | ||
1871 | sun4v_set_version: | ||
1872 | mov HV_CORE_SET_VER, %o5 | ||
1873 | mov %o3, %o4 | ||
1874 | ta HV_CORE_TRAP | ||
1875 | retl | ||
1876 | stx %o1, [%o4] | ||
1877 | |||
1878 | /* %o0: pointer to unsigned long status | ||
1879 | * | ||
1880 | * returns %o0: signed character | ||
1881 | */ | ||
1882 | .globl sun4v_con_getchar | ||
1883 | sun4v_con_getchar: | ||
1884 | mov %o0, %o4 | ||
1885 | mov HV_FAST_CONS_GETCHAR, %o5 | ||
1886 | clr %o0 | ||
1887 | clr %o1 | ||
1888 | ta HV_FAST_TRAP | ||
1889 | stx %o0, [%o4] | ||
1890 | retl | ||
1891 | sra %o1, 0, %o0 | ||
1892 | |||
1893 | /* %o0: signed long character | ||
1894 | * | ||
1895 | * returns %o0: status | ||
1896 | */ | ||
1897 | .globl sun4v_con_putchar | ||
1898 | sun4v_con_putchar: | ||
1899 | mov HV_FAST_CONS_PUTCHAR, %o5 | ||
1900 | ta HV_FAST_TRAP | ||
1901 | retl | ||
1902 | sra %o0, 0, %o0 | ||
1903 | |||
1904 | /* %o0: buffer real address | ||
1905 | * %o1: buffer size | ||
1906 | * %o2: pointer to unsigned long bytes_read | ||
1907 | * | ||
1908 | * returns %o0: status | ||
1909 | */ | ||
1910 | .globl sun4v_con_read | ||
1911 | sun4v_con_read: | ||
1912 | mov %o2, %o4 | ||
1913 | mov HV_FAST_CONS_READ, %o5 | ||
1914 | ta HV_FAST_TRAP | ||
1915 | brnz %o0, 1f | ||
1916 | cmp %o1, -1 /* break */ | ||
1917 | be,a,pn %icc, 1f | ||
1918 | mov %o1, %o0 | ||
1919 | cmp %o1, -2 /* hup */ | ||
1920 | be,a,pn %icc, 1f | ||
1921 | mov %o1, %o0 | ||
1922 | stx %o1, [%o4] | ||
1923 | 1: retl | ||
1924 | nop | ||
1925 | |||
1926 | /* %o0: buffer real address | ||
1927 | * %o1: buffer size | ||
1928 | * %o2: pointer to unsigned long bytes_written | ||
1929 | * | ||
1930 | * returns %o0: status | ||
1931 | */ | ||
1932 | .globl sun4v_con_write | ||
1933 | sun4v_con_write: | ||
1934 | mov %o2, %o4 | ||
1935 | mov HV_FAST_CONS_WRITE, %o5 | ||
1936 | ta HV_FAST_TRAP | ||
1937 | stx %o1, [%o4] | ||
1938 | retl | ||
1939 | nop | ||